# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244507 | 2020-07-04T08:16:52 Z | dantoh000 | Pipes (CEOI15_pipes) | C++14 | 1534 ms | 65540 KB |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; typedef pair<int,int> ii; int n,m; map<int,bool> M[30005]; vector<ii> G[30005]; int num[30005]; int p[30005]; int low[30005]; int ct = 1; void dfs(int u){ low[u] = num[u] = ct++; for (auto v : G[u]){ if (num[v.first] == 0){ p[v.first] = u; dfs(v.first); if (low[v.first] > num[u]){ if (v.second == 0){ printf("%d %d\n",u,v); } } low[u] = min(low[u],low[v.first]); } else if (v.first != p[u]){ low[u] = min(low[u],num[v.first]); } } } int main(){ scanf("%d%d",&n,&m); for (int i = 0; i < m; i++){ int u,v; scanf("%d%d",&u,&v); if (u > v) swap(u,v); if (M[u].count(v)){ M[u][v] = 1; } else{ M[u][v] = 0; } } for (int u = 1; u <= n; u++){ auto it = M[u].begin(); while (it != M[u].end()){ int v = it->first, w = it->second; G[u].push_back({v,w}); G[v].push_back({u,w}); it = M[u].erase(it); } } for (int i = 1; i <= n; i++){ if (num[i] == 0){ dfs(i); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2432 KB | Output is correct |
2 | Correct | 6 ms | 2432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 3316 KB | Output is correct |
2 | Correct | 12 ms | 3072 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 759 ms | 43324 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1414 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1534 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 9 ms | 4840 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 4736 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 4736 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 4736 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 9 ms | 4736 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |