Submission #370991

#TimeUsernameProblemLanguageResultExecution timeMemory
370991FatihSolakRonald (COCI17_ronald)C++17
120 / 120
136 ms3360 KiB
#include <bits/stdc++.h> #define N 1005 using namespace std; bool adj[N][N]; int n,m; bool calc(){ vector<int> ch; for(int i=2;i<=n;i++){ if(!adj[1][i]){ ch.push_back(i); } } for(auto u:ch){ for(int i=1;i<=n;i++){ if(u != i) adj[u][i] = adj[i][u] = !adj[u][i]; } } int cnt = 0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cnt += adj[i][j]; } } return cnt == (n*(n-1)); } int main(){ cin >> n >> m; for(int i=0;i<m;i++){ int a,b; cin >> a >> b; adj[a][b] = 1; adj[b][a] = 1; } bool ok = calc(); for(int i=2;i<=n;i++){ adj[1][i] = adj[i][1] = !adj[1][i]; } ok |= calc(); cout << (ok?"DA":"NE") << endl; }
#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...