Submission #202053

#TimeUsernameProblemLanguageResultExecution timeMemory
202053SamAndRonald (COCI17_ronald)C++17
120 / 120
63 ms3320 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1003; int n, m; bool a[N][N]; int c[N]; bool dfs(int x, int u) { c[x] = u; for (int h = 1; h <= n; ++h) { if (h == x) continue; if (!c[h]) { if (a[x][h] == false) { if (!dfs(h, 3 - u)) return false; } else { if (!dfs(h, u)) return false; } } else { if (a[x][h] == false) { if (c[h] != 3 - u) return false; } else { if (c[h] != u) return false; } } } return true; } int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; ++i) { int x, y; scanf("%d%d", &x, &y); a[x][y] = true; a[y][x] = true; } if (dfs(1, 1)) { printf("DA\n"); return 0; } printf("NE\n"); return 0; }

Compilation message (stderr)

ronald.cpp: In function 'int main()':
ronald.cpp:50:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
ronald.cpp:54:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &x, &y);
         ~~~~~^~~~~~~~~~~~~~~~
#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...