Submission #228665

#TimeUsernameProblemLanguageResultExecution timeMemory
228665CantfindmeRonald (COCI17_ronald)C++17
105 / 120
50 ms10232 KiB
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int,int> pi; #define f first #define s second #define FAST ios_base::sync_with_stdio(0); cin.tie(0); const int maxn = 1010; int n,e; int edge[maxn][maxn]; int visited[maxn]; vector <int> v; void test(int x) { if (visited[x]) return; visited[x] = 1; v.push_back(x); for (int i =1;i<=n;i++) { if (edge[x][i]) test(i); } } int32_t main() { FAST cin >> n >> e; for (int i =0;i<e;i++) { int a,b; cin >> a >> b; edge[a][b] = edge[b][a] = 1; } bool fail = false; for (int x =1;x<=n;x++) { if (!visited[x]) test(x); for (auto i: v) { for (auto j: v) { if (i == j) continue; if (!edge[i][j]) fail = true; } } v.clear(); } if (fail) cout << "NE"; else cout << "DA"; }
#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...