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;
const ll MOD = 1e9+7;
const int N = 1e3+5;
int n,m,mat[N][N],a[N][N];
vector<int>v[N],r[N];
void change(){
for(int i=2;i<=n;i++){
if(!mat[1][i]){
for(int j=1;j<=n;j++){
if(j==i)continue;
mat[i][j]^=1;
mat[j][i]^=1;
}
}
}
}
void check(){
bool ok=true;
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(!mat[i][j]&&i!=j)ok=false;
if(ok){
cout<<"DA";
exit(0);
}
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n>>m;
int x,y;
while(m--){
cin>>x>>y;
mat[x][y]=1;
mat[y][x]=1;
a[x][y]=1;
a[y][x]=1;
}
change();
check();
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)mat[i][j]=a[i][j];
for(int i=2;i<=n;i++){
mat[1][i]^=1;
mat[i][1]^=1;
}
change();
check();
cout<<"NE";
return 0;
}
# | 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... |