# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
914091 | 1075508020060209tc | Senior Postmen (BOI14_postmen) | C++14 | 424 ms | 68464 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define X first
#define Y second
#define SZ(x) (int)(x).size()
int n;int m;
int ar[500005];
vector<int>e[500005];
int eit[500005];
//bool vis[500005];
//bool visv[500005];
bitset<500005>vis;
bitset<500005>visv;
int id;
int ssz;
int stk[500005];
void dfs(int nw){
for(;eit[nw]<e[nw].size();eit[nw]++){
id=e[nw][eit[nw]];
if(vis[id]){continue;}
vis[id]=1;
int v=ar[id]^nw;
dfs(v);
}
int v=nw;
if(visv[v]){
while(1){
cout<<stk[ssz-1];
if(stk[ssz-1]==v){cout<<'\n';break;}else{
cout<<' ';
}
visv[stk[ssz-1]]=0;
ssz--;
}
}else{
visv[v]=1;
stk[ssz++]=v;
}
}
signed main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>n>>m;
for(int i=1;i<=m;i++){
int b;
cin>>ar[i]>>b;
e[ar[i]].push_back(i);
e[b].push_back(i);
ar[i]^=b;
}
dfs(1);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |