# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
948609 |
2024-03-18T08:37:47 Z |
vjudge1 |
Pipes (CEOI15_pipes) |
C++17 |
|
177 ms |
16704 KB |
#include <iostream>
#include <vector>
using namespace std;
const short N = 10001;
vector<pair<short,short>> g[N];
vector<short> tin(N), low(N);
void dfs(short v, int p, vector<bool>& vis, short& 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(){
short n;
int m;
cin >> n >> m;
for(int i = 0; i < m; i++){
short a, b;
cin >> a >> b;
g[a].emplace_back(b, i);
g[b].emplace_back(a, i);
}
vector<bool> vis(n + 1, false);
short timer = 0;
for(short i = 1; 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 |
604 KB |
Output is correct |
2 |
Correct |
0 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 |
Correct |
78 ms |
8920 KB |
Output is correct |
2 |
Correct |
96 ms |
8320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
153 ms |
12076 KB |
Output is correct |
2 |
Runtime error |
177 ms |
16704 KB |
Memory limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |