This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int n, m, x, y;
bool a[1005][1005], b[1005][1005];
void flip(bool a[1005][1005], int x) {
FOR(i, 1, n) {
a[i][x] = !a[i][x];
a[x][i] = !a[x][i];
}
}
bool check(bool a[1005][1005]) {
FOR(i, 2, n) if (!a[i][1]) flip(a, i);
FOR(i, 1, n) FOR(j, i+1, n) if (!a[i][j]) return false;
return true;
}
int main() {
fastio; cin >> n >> m;
FOR(i, 1, m) {
cin >> x >> y;
a[x][y] = a[y][x] = 1;
b[x][y] = b[y][x] = 1;
}
if (check(a)) {cout << "DA"; return 0;}
flip(b, 1);
if (check(b)) cout << "DA";
else cout << "NE";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |