# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527337 | 2022-02-17T08:31:41 Z | jamielim | Pipes (CEOI15_pipes) | C++14 | 2032 ms | 65540 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb emplace_back #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() typedef long long ll; typedef pair<int,int> ii; typedef pair<ii,ii> i4; const int MOD=1000000007; const int INF=1012345678; const ll LLINF=1012345678012345678LL; const double PI=3.1415926536; const double EPS=1e-14; const int MAXN=100001; int n,m; vector<int> adj[MAXN]; vector<ii> ans; int par[MAXN]; int dep[MAXN]; int low[MAXN]; int ctr=1; void dfs(int x){ dep[x]=low[x]=ctr++; for(int i:adj[x]){ if(dep[i]==0){ // not yet visited par[i]=x; dfs(i); if(low[i]>dep[x])ans.pb(i,x); low[x]=min(low[x],low[i]); }else if(i!=par[x])low[x]=min(low[x],dep[i]); } } int main(){ scanf("%d%d",&n,&m); int a,b; for(int i=0;i<m;i++){ scanf("%d%d",&a,&b); adj[a].pb(b);adj[b].pb(a); } for(int i=1;i<=n;i++)if(dep[i]==0)dfs(i); for(ii i:ans)printf("%d %d\n",i.fi,i.se); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2636 KB | Output is correct |
2 | Incorrect | 1 ms | 2636 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3320 KB | Output is correct |
2 | Incorrect | 5 ms | 3020 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 147 ms | 11480 KB | Output is correct |
2 | Correct | 149 ms | 10692 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 255 ms | 15452 KB | Output is correct |
2 | Runtime error | 308 ms | 19236 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 468 ms | 26792 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 764 ms | 33108 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1111 ms | 55368 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1534 ms | 65540 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1976 ms | 65540 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2032 ms | 65540 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |