# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
948340 | 2024-03-18T04:33:15 Z | vjudge1 | Pipes (CEOI15_pipes) | C++17 | 410 ms | 65536 KB |
#include <bits/stdc++.h> #define ll long long #define str string #define ins insert #define ld long double #define pb push_back #define pf push_front #define pof pop_front() #define pob pop_back() #define lb lower_bound #define ub upper_bound #define endl "\n" #define fr first #define sc second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define sz size() #define vll vector<ll> #define bc back() #define arr array #define pll vector<pair<ll,ll>> using namespace std;/* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>*/ template<class S,class T> bool chmin(S &a,const T &b) { return a>b?(a=b)==b:false; } template<class S,class T> bool chmax(S &a,const T &b) { return a<b?(a=b)==b:false; } void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll inf=1e18; const ll mod=1e9+7; const ll N=1e5+5; const ll M=6e6+5; const ld eps=1e-9; vector<vll> g(N); ll d[N],up[N]; pair<ll,ll> e[M]; ll br[M]; void dfs(ll v,ll x){ ll i,b; up[v]=d[v]; for(i=0;i<g[v].sz;i++){ if(g[v][i]==x) continue; if(e[g[v][i]].fr==v) b=e[g[v][i]].sc; else b=e[g[v][i]].fr; if(d[b]){chmin(up[v],d[b]);continue;} d[b]=d[v]+1; dfs(b,g[v][i]); chmin(up[v],up[b]); } if(up[v]>=d[v])br[x]=1; } void solve(){ ll i,j; ll n,m,a,b; cin>>n>>m; for(i=1;i<=m;i++){ cin>>e[i].fr>>e[i].sc; g[e[i].fr].pb(i); g[e[i].sc].pb(i); } for(i=1;i<=n;i++){ if(!d[i]){ d[i]=1; dfs(i,0); } } for(i=1;i<=m;i++){ if(br[i]) cout<<e[i].fr<<' '<<e[i].sc<<endl; } } signed main(){ start(); ll t=1; //cin>>t; while(t--) solve(); return 0; } /* */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4700 KB | Output is correct |
2 | Correct | 1 ms | 4700 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5468 KB | Output is correct |
2 | Correct | 4 ms | 5212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 105 ms | 30784 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 199 ms | 52732 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 269 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 372 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 359 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 410 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 404 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 391 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |