제출 #49489

#제출 시각아이디문제언어결과실행 시간메모리
49489minkank어르신 집배원 (BOI14_postmen)C++17
55 / 100
532 ms63400 KiB
#include <iostream> #include <set> #include <stack> #include <vector> using namespace std; typedef pair<int, int> ii; const int N = 5e5 + 5; int n, m, st[N], p, ptr[N]; bool check[N], sax[N]; vector<int> s[N]; vector<ii> edge; void dfs(int u) { while(ptr[u] >= 0) { int id = s[u][ptr[u]]; ptr[u]--; if(sax[id]) continue; sax[id] = true; int v; if(edge[id].first == u) v = edge[id].second; else v = edge[id].first; 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; } void get(int &x) { x = 0; char c = getchar(); while(c > '9' || c < '0') c = getchar(); while(c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar(); } int main() { get(n); get(m); for(int i = 1; i <= m; ++i) { int u, v; get(u); get(v); s[u].push_back(edge.size()); s[v].push_back(edge.size()); edge.push_back(ii(u, v)); } for(int i = 1; i <= n; ++i) ptr[i] = s[i].size() - 1; dfs(1); }

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

postmen.cpp: In function 'void dfs(int)':
postmen.cpp:24: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:24: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--;
                                                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...