# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
675624 |
2022-12-27T14:02:22 Z |
penguin133 |
Pipes (CEOI15_pipes) |
C++14 |
|
992 ms |
65536 KB |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
int ret[100005], dep[100005], vis[100005];
vector<int>v[100005];
int n, m;
inline int read() {
int v = 0;
char ch = getchar_unlocked();
while ((ch & 16) == 0) ch = getchar_unlocked();
while (ch & 16){
v = (v * 10) + (ch & 15);
ch = getchar_unlocked();
}
return v;
}
vector<pi>ans;
void dfs(int x, int p, int d){
if(vis[x])return;
vis[x] = 1;
dep[x] = d;
ret[x] = dep[x];
bool f = 0;
for(auto i : v[x]){
if(i == p && !f){
f = 1;
continue;
}
if(vis[i]){
ret[x] = min(ret[x], dep[i]);
continue;
}
dfs(i, x, d + 1);
if(ret[i] > dep[x])cout << i << " " << x << '\n';
ret[x] = min(ret[x], ret[i]);
}
}
int32_t main(){
//ios::sync_with_stdio(0);cin.tie(0);
n = read(), m = read();
for(int i=1;i<=m;i++){
int x = read(), y = read();
v[x].push_back(y);
v[y].push_back(x);
}
for(int i=1;i<=n;i++)if(!vis[i])dfs(i, -1, 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3284 KB |
Output is correct |
2 |
Correct |
4 ms |
3052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
11172 KB |
Output is correct |
2 |
Correct |
45 ms |
15520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
14668 KB |
Output is correct |
2 |
Runtime error |
101 ms |
30076 KB |
Memory limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
146 ms |
26292 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
328 ms |
42016 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
509 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
782 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
856 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
992 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |