# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
243847 |
2020-07-02T02:29:36 Z |
errorgorn |
Pipes (CEOI15_pipes) |
C++14 |
|
2589 ms |
65540 KB |
//雪花飄飄北風嘯嘯
//天地一片蒼茫
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}
#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
int n,m;
vector<int> al[100005];
int dfs_time[100005]; ///first time to reach vertex
int low[100005]; ///lowest time vertex it can reach with 1 backtrack
int dfs_counter=1;
void dfs(int i,int j){ ///j is parent of i
dfs_time[i]=low[i]=dfs_counter++;
for (vector<int>::iterator it=al[i].begin();it!=al[i].end();it++){
if (!dfs_time[*it]){ ///uninitialized vertex
dfs(*it,i);
low[i]=min(low[i],low[*it]);
if (low[*it]>dfs_time[i]){
cout<<*it<<" "<<i<<endl;
}
}
else if (*it!=j){ ///make sure it is a back edge
low[i]=min(low[i],dfs_time[*it]);
}
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
int a,b;
rep(x,0,m){
cin>>a>>b;
al[a].push_back(b);
al[b].push_back(a);
}
rep(x,1,n+1) if (!dfs_time[x]) dfs(x,-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2688 KB |
Output is correct |
2 |
Incorrect |
6 ms |
2688 KB |
Wrong number of edges |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
3328 KB |
Output is correct |
2 |
Incorrect |
9 ms |
3072 KB |
Wrong number of edges |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
130 ms |
11000 KB |
Output is correct |
2 |
Correct |
129 ms |
10232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
238 ms |
14328 KB |
Output is correct |
2 |
Runtime error |
283 ms |
30172 KB |
Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
473 ms |
25184 KB |
Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
788 ms |
30304 KB |
Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1321 ms |
65536 KB |
Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1820 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2351 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2589 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |