제출 #115986

#제출 시각아이디문제언어결과실행 시간메모리
115986ckodser어르신 집배원 (BOI14_postmen)C++14
55 / 100
625 ms55780 KiB
#include<bits/stdc++.h> #define ll int #define pb push_back #define mp make_pair #define ld long double #define F first #define S second #define pii pair<ll,ll> using namespace :: std; const ll mod=1e9+7; const ll maxn=5e5+500; const ll inf=1e9+900; vector<ll> ger[maxn]; ll s[maxn]; ll t[maxn]; bool vis[maxn]; ll l[maxn]; stack<ll> ans; bool inAns[maxn]; void dfs(ll a){ while(l[a]<ger[a].size()){ if(vis[ger[a][l[a]]]){ l[a]++; }else{ ll e=ger[a][l[a]]; vis[e]=1; dfs(s[e]^t[e]^a); } } if(inAns[a]){ while(ans.top()!=a){ printf("%d ",ans.top()); inAns[ans.top()]=0; ans.pop(); } printf("%d\n",a); }else{ ans.push(a); inAns[a]=1; } } int main(){ ll n,m; scanf("%d%d",&n,&m); for(ll i=0;i<m;i++){ scanf("%d%d",&s[i],&t[i]); ger[s[i]].pb(i); ger[t[i]].pb(i); } dfs(1); }

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

postmen.cpp: In function 'void dfs(int)':
postmen.cpp:27:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(l[a]<ger[a].size()){
           ~~~~^~~~~~~~~~~~~~
postmen.cpp: In function 'int main()':
postmen.cpp:50: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:52:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&s[i],&t[i]);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...