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;
const int maxn = 1e3+3;
bool state[maxn], tab[maxn][maxn], ok=1;
int main(){
int n, m;
cin >> n >> m;
for(int i=0; i<m; i++){
int x, y;
cin >> x >> y;
tab[x][y]=tab[y][x]=1;
}
for(int i=2; i<=n; i++){
state[i]=state[i-1];
if(tab[i][i-1]==0)state[i]^=1;
}
for(int i=1; i<=n; i++){
for(int j=i+1; j<=n; j++){
int sum = state[i]+state[j];
if(tab[i][j]==0)if(sum%2==0)ok=0;
if(tab[i][j]==1)if(sum%2==1)ok=0;
}
if(ok==0){
cout << "NE\n";
return 0;
}
}
cout << "DA\n";
}
# | 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... |