# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
581721 | 2022-06-23T04:52:30 Z | 반딧불(#8365) | 전압 (JOI14_voltage) | C++14 | 1000 ms | 14708 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; vector<pair<int, int> > link[100002]; int ex[100002], ey[100002]; int ans; int p; bool visited[100002]; bool col[100002]; bool dfs(int x){ visited[x] = 1; for(auto y: link[x]){ int nc = !col[x]; if(y.second == p) nc=!nc; if(visited[y.first]){ if(col[y.first]!=nc) return false; continue; } col[y.first] = nc; if(!dfs(y.first)) return false; } return true; } int main(){ scanf("%d %d", &n, &m); for(int i=1; i<=m; i++){ int x, y; scanf("%d %d", &x, &y); link[x].push_back(make_pair(y, i)); link[y].push_back(make_pair(x, i)); ex[i] = x, ey[i] = y; } for(int i=1; i<=m; i++){ p=i; memset(visited, 0, sizeof(visited)); bool able=1; for(int j=1; j<=n; j++){ if(visited[j]) continue; if(!dfs(j)){ able=0; break; } } if(able) ans++; } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2876 KB | Output is correct |
2 | Correct | 21 ms | 2800 KB | Output is correct |
3 | Correct | 10 ms | 2772 KB | Output is correct |
4 | Correct | 20 ms | 2772 KB | Output is correct |
5 | Correct | 34 ms | 2848 KB | Output is correct |
6 | Correct | 46 ms | 2772 KB | Output is correct |
7 | Correct | 41 ms | 2772 KB | Output is correct |
8 | Correct | 19 ms | 2856 KB | Output is correct |
9 | Correct | 26 ms | 2772 KB | Output is correct |
10 | Correct | 34 ms | 2856 KB | Output is correct |
11 | Correct | 15 ms | 2792 KB | Output is correct |
12 | Correct | 33 ms | 2772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 7512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 7492 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 31 ms | 14708 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |