Submission #348755

#TimeUsernameProblemLanguageResultExecution timeMemory
348755JovanK26Ronald (COCI17_ronald)C++14
120 / 120
47 ms10092 KiB
#include <bits/stdc++.h> using namespace std; int n,m; int a[1001][1001]; int b[1001][1001]; void flip(int a[1001][1001],int x) { for(int i=0;i<n;i++) { a[i][x]=a[x][i]=1-a[i][x]; } } bool check(int a[1001][1001]) { for(int i=1;i<n;i++) { if(!a[i][0]) { flip(a,i); } } for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(!a[i][j])return 0; } } return 1; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int x,y; cin >> n >> m; for(int i=0;i<m;i++) { cin >> x >> y; 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,0); if(check(b)) { cout << "DA"; } else { cout << "NE"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...