# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
948528 |
2024-03-18T07:39:21 Z |
vjudge1 |
Pipes (CEOI15_pipes) |
C++17 |
|
761 ms |
65536 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define ff first
#define ss second
#define rep(i,s,f) for(int i = s;i < f;i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
const int INF = 1e18,N = 2e5 + 1;
const int p = 31,m = 1e9 + 9,MOD7 = 1e9 + 7;
int binpow(int n,int k){
if(k == 0){
return 1 ;
} else if(k % 2 == 0){
int b = binpow(n,k / 2);
return b * b ;
} else{
return n * binpow(n,k - 1) ;
}
}
int timer;
vector<int> g[N];
vector<bool> vis(N);
vector<int> tin(N),low(N);
void dfs(int v, int p) {
vis[v] = true;
tin[v] = low[v] = timer++;
for (int to : g[v]) {
if (to == p) continue;
if (vis[to]) {
low[v] = min(low[v], tin[to]);
} else {
dfs(to, v);
low[v] = min(low[v], low[to]);
if (low[to] > tin[v])
cout << v << " " << to << "\n";
}
}
}
void solve(){
int n;
cin >> n;
int m;
cin >> m;
for(int i = 0;i < m;i++){
int a,b;
cin >> a >> b;
g[a].pb(b);
g[b].pb(a);
}
for(int i = 0;i < n;i++){
if(!vis[i]){
dfs(i,-1);
}
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t = 1;
//~ cin >> t;
while(t--){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8280 KB |
Output is correct |
2 |
Incorrect |
3 ms |
8284 KB |
Wrong number of edges |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8796 KB |
Output is correct |
2 |
Incorrect |
5 ms |
8536 KB |
Wrong number of edges |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
88 ms |
24096 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
189 ms |
30140 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
295 ms |
50328 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
441 ms |
55492 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
612 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
689 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
737 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
761 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |