Submission #227314

#TimeUsernameProblemLanguageResultExecution timeMemory
227314Abdul_MannanSenior Postmen (BOI14_postmen)C++14
0 / 100
19 ms23808 KiB
#include "bits/stdc++.h" using namespace std; const int maxn = 500005; multiset<int> edges[maxn]; vector<int> path; void dfs(int x){ while(!edges[x].empty()){ int i = *edges[x].begin(); edges[x].erase(edges[x].find(i)); edges[i].erase(edges[i].find(x)); dfs(i); } path.push_back(x); } int main(int argc, char const *argv[]) { // freopen("in.txt", "r", stdin); int n, m; scanf("%d %d", &n, &m); for(int i = 0; i < m; ++i){ int x, y; scanf("%d %d", &x, &y); edges[x].insert(y); edges[y].insert(x); } dfs(1); path.pop_back(); for(int i = 0; i < path.size(); i++) { printf("%d ",path[i]); } printf("\n"); return 0; }

Compilation message (stderr)

postmen.cpp: In function 'int main(int, const char**)':
postmen.cpp:31:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < path.size(); i++)
                 ~~^~~~~~~~~~~~~
postmen.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
postmen.cpp:25:8: 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...