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;
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 |
---|
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... |