Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int x;
- cin >> x;
- int tot = 0;
- for (int i=0; i < x*x; i++) {
- int y;
- cin >> y;
- if (y == 1) {
- tot += 1;
- }
- }
- if (tot == 2*(x-1) {
- cout << "YES" << endl;
- }
- else {
- cout << "NO" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment