#include<bits/stdc++.h>
using namespace std;
int vis[1005];
int edge[1005][1005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
int m;cin>>m;
for(int i=1;i<=m;i++){
int a,b;cin>>a>>b;
edge[a][b]=1;
edge[b][a]=1;
}
int check=1;
for(int i=1;i<=n;i++){
if(!vis[i]){
vis[i]=1;
vector<int>v;
for(int j=1;j<=n;j++)if(edge[i][j])v.push_back(j),vis[j]=1;
for(auto x:v){
for(int k=1;k<=n;k++){
if(k!=x&&k!=i){
if(edge[x][k]!=edge[i][k]){
check=0;
break;
}
}
}
if(!check)break;
}
}
if(!check)break;
}
if(check)cout<<"DA";
else cout<<"NE";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2648 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2652 KB |
Output is correct |
2 |
Correct |
7 ms |
3164 KB |
Output is correct |
3 |
Correct |
3 ms |
2808 KB |
Output is correct |
4 |
Correct |
3 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2652 KB |
Output is correct |
2 |
Correct |
4 ms |
2784 KB |
Output is correct |
3 |
Correct |
17 ms |
5464 KB |
Output is correct |
4 |
Correct |
32 ms |
6228 KB |
Output is correct |