Submission #26872

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
268722017-07-06 16:32:49top34051Senior Postmen (BOI14_postmen)C++14
38 / 100
1094 ms23416 KiB
#include<bits/stdc++.h>
using namespace std;
#define maxn 500005
int n,m;
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(i=0;i<from[x].size();i++) {
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() {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

postmen.cpp: In function 'void dfs(int, int)':
postmen.cpp:21:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0;i<from[x].size();i++) {
             ~^~~~~~~~~~~~~~~
postmen.cpp: At global scope:
postmen.cpp:30:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
postmen.cpp: In function 'int main()':
postmen.cpp:32: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:34: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...