Submission #16847

#TimeUsernameProblemLanguageResultExecution timeMemory
16847kdh9949Senior Postmen (BOI14_postmen)C++98
0 / 100
9 ms708 KiB
#include<stdio.h> #include<stack> using namespace std; struct E{int dest,next;}; stack<int> st; E elist[1001010]; int fe[500010],vis[500010],chk[1000010]; int n,m,a,b; void f(int node){ if(vis[node]){ while(st.top() != node){ printf("%d ",st.top()); vis[st.top()]=0; st.pop(); } st.pop(); printf("%d\n",node); } vis[node]=1; for(int i=fe[node];i;i=elist[i].next){ if(chk[i]){ fe[node]=elist[i].next; continue; } chk[i]=chk[i+(i%2?-1:1)]=1; fe[node]=elist[i].next; st.push(node); f(elist[i].dest); } } int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=m;i++){ scanf("%d%d",&a,&b); elist[2*i]={b,fe[a]}; elist[2*i+1]={a,fe[b]}; fe[a]=2*i; fe[b]=2*i+1; } f(1); }

Compilation message (stderr)

postmen.cpp: In function 'int main()':
postmen.cpp:36:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
postmen.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a,&b);
         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...