제출 #31521

#제출 시각아이디문제언어결과실행 시간메모리
31521minkank어르신 집배원 (BOI14_postmen)C++14
55 / 100
982 ms115288 KiB
#include <iostream> #include <set> #include <stack> using namespace std; const int N = 5e5 + 5; int n, m, check[N]; set<int> s[N]; stack<int> st; 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.top() != u) cout << st.top() << ' ', check[st.top()] = false, st.pop(); st.pop(); cout << u << endl; } check[u] = 1; st.push(u); } int main() { cin >> n >> m; for(int i = 1; i <= m; ++i) { int u, v; cin >> u >> v; s[u].insert(v); s[v].insert(u); } dfs(1); }

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

postmen.cpp: In function 'void dfs(int)':
postmen.cpp:18:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   while(st.top() != u) cout << st.top() << ' ', check[st.top()] = false, st.pop(); st.pop();
   ^~~~~
postmen.cpp:18:84: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   while(st.top() != u) cout << st.top() << ' ', check[st.top()] = false, st.pop(); st.pop();
                                                                                    ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...