# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
948542 |
2024-03-18T07:47:55 Z |
vjudge1 |
Pipes (CEOI15_pipes) |
C++17 |
|
95 ms |
16464 KB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 5000;
vector<pair<int,int>> g[N];
vector<int> tin(N), low(N);
void dfs(int v, int p, vector<bool>& vis, int& timer) {
vis[v] = true;
tin[v] = low[v] = timer++;
for (auto [to, check] : g[v]) {
if (check == p)
continue;
if(vis[to]){
low[v] = min(low[v], low[to]);
} else{
dfs(to, check, vis, timer);
low[v] = min(low[v], low[to]);
if (low[to] > tin[v])
cout << v << " " << to << "\n";
}
}
}
void solve(){
int n, m;
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b;
cin >> a >> b;
g[a].emplace_back(b, i);
g[b].emplace_back(a, i);
}
vector<bool> vis(n, false);
int timer = 0;
for(int i = 0; i < n; i++){
if(!vis[i]){
dfs(i, -1, vis, timer);
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1116 KB |
Output is correct |
2 |
Correct |
3 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
95 ms |
16464 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |