Submission #39890

#TimeUsernameProblemLanguageResultExecution timeMemory
39890LkvatashidzeSenior Postmen (BOI14_postmen)C++14
0 / 100
6 ms384 KiB
#include <bits/stdc++.h> using namespace std; int n, m; int g[2005][2005]; vector < int > ans; /* void DFS (int v) { set < int > ::iterator st_it; for (st_it=g[v].begin(); st_it!=g[v].end(); st_it++) { int p=(*st_it); g[v].erase(p); g[p].erase(v); ans.push_back(v); DFS(p); } for (int k=0; k<ans.size(); k++) { cout << ans[k] << ' '; exit(0); } } */ void DFS (int v) { for (int k=1; k<=n; k++) if (g[k][v]>0) { g[k][v]--; g[v][k]--; DFS(k); } ans.push_back(v); } int main () { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int k=1; k<=m; k++) { int x, y; cin >> x >> y; // g[x].insert(y); // g[y].insert(x); g[x][y]++; g[y][x]++; } DFS(1); for (int k=0; k<ans.size()-1; k++) cout << ans[k] << ' '; return 0; }

Compilation message (stderr)

postmen.cpp: In function 'int main()':
postmen.cpp:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int k=0; k<ans.size()-1; k++)
                 ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...