제출 #31528

#제출 시각아이디문제언어결과실행 시간메모리
31528minhtung0404어르신 집배원 (BOI14_postmen)C++14
55 / 100
632 ms141180 KiB
#include<bits/stdc++.h> const int N = 5e5 + 5; using namespace std; set <int> adj[N]; vector <int> mv[N]; int n, m, a, b, cnt; bool check[N], edge[N]; stack <int> ms; void dfs(int u){ while (adj[u].size()){ int v = *adj[u].begin(); adj[u].erase(adj[u].begin()); adj[v].erase(u); dfs(v); } if (check[u]){ while (ms.top() != u){ printf("%d ", ms.top()); check[ms.top()] = 0; ms.pop(); } printf("%d\n", u); ms.pop(); check[u] = 0; } check[u] = 1; ms.push(u); } int main(){ scanf("%d%d", &n, &m); for (int i = 0; i < m; i++){ scanf("%d%d", &a, &b); adj[a].insert(b); adj[b].insert(a); } dfs(1); }

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

postmen.cpp: In function 'int main()':
postmen.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
postmen.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...