Submission #31531

#TimeUsernameProblemLanguageResultExecution timeMemory
31531minkankSenior Postmen (BOI14_postmen)C++14
55 / 100
629 ms100216 KiB
#include <iostream> #include <set> #include <stack> using namespace std; const int N = 5e5 + 5; int n, m, st[N], p; bool check[N]; set<int> s[N]; void dfs(int u) { while(s[u].size()) { int v = *s[u].begin(); s[u].erase(v); s[v].erase(u); dfs(v); } if(check[u]) { while(st[p] != u) cout << st[p] << ' ', check[st[p]] = false, p--; p--; cout << u << '\n'; } check[u] = 1; ++p; st[p] = u; } int main() { scanf("%d %d", &n, &m); for(int i = 1; i <= m; ++i) { int u, v; scanf("%d %d", &u, &v); s[u].insert(v); s[v].insert(u); } dfs(1); }

Compilation message (stderr)

postmen.cpp: In function 'void dfs(int)':
postmen.cpp:18:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   while(st[p] != u) cout << st[p] << ' ', check[st[p]] = false, p--; p--;
   ^~~~~
postmen.cpp:18:70: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   while(st[p] != u) cout << st[p] << ' ', check[st[p]] = false, p--; p--;
                                                                      ^
postmen.cpp: In function 'int main()':
postmen.cpp:25: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:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &u, &v);
   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...