제출 #26873

#제출 시각아이디문제언어결과실행 시간메모리
26873top34051어르신 집배원 (BOI14_postmen)C++14
55 / 100
550 ms86652 KiB
#include<bits/stdc++.h> using namespace std; #define maxn 500005 int n,m; int now[maxn]; int out[maxn]; bool vis[maxn]; vector<pair<int,int> > from[maxn]; stack<pair<int,int> > st; void dfs(int x,int last) { int i,y; if(out[x]) { while(!st.empty()) { y = st.top().first; printf("%d ",y); --out[y]; st.pop(); if(y==x) break; } printf("\n"); } for(;now[x]<from[x].size();) { i = now[x]++; if(!vis[from[x][i].second]) { ++out[x]; st.push({x,from[x][i].first}); vis[from[x][i].second] = 1; dfs(from[x][i].first,x); } } } main() { int i,x,y; scanf("%d%d",&n,&m); for(i=1;i<=m;i++) { scanf("%d%d",&x,&y); from[x].push_back({y,i}); from[y].push_back({x,i}); } dfs(1,0); }

컴파일 시 표준 에러 (stderr) 메시지

postmen.cpp: In function 'void dfs(int, int)':
postmen.cpp:22:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(;now[x]<from[x].size();) {
          ~~~~~~^~~~~~~~~~~~~~~
postmen.cpp: At global scope:
postmen.cpp:32:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
postmen.cpp: In function 'int main()':
postmen.cpp:34: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:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x,&y);
         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...