제출 #240493

#제출 시각아이디문제언어결과실행 시간메모리
240493karma어르신 집배원 (BOI14_postmen)C++14
55 / 100
523 ms44792 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,fma") #define pb emplace_back #define ll long long #define fi first #define se second #define mp make_pair //#define int int64_t using namespace std; const int N = int(5e5) + 10; typedef pair<int, int> pii; struct TEdge { int u, v; bool del; } e[N]; int n, m, vis[N], ss[N], st[N], cnts, cntt; int path[N], cp, u, id; vector<int> adj[N]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define Task "test" if(fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } scanf("%d %d", &n, &m); for(int i = 1; i <= m; ++i) { scanf("%d %d", &e[i].u, &e[i].v); adj[e[i].u].pb(i); adj[e[i].v].pb(i); } path[++cp] = 1; do { u = path[cp]; while(adj[u].size() && e[adj[u].back()].del) adj[u].pop_back(); if(adj[u].size()) { id = adj[u].back(); adj[u].pop_back(); e[id].del = 1; path[++cp] = e[id].u ^ e[id].v ^ u; } else { st[++cntt] = u; --cp; } } while(cp > 0); while(cntt) { u = st[cntt]; if(vis[u]) { while(1) { vis[ss[cnts]] = 0; printf("%d ", ss[cnts]); if(ss[cnts --] == u) break; } puts(""); } vis[u] = 1; ss[++cnts] = u; --cntt; } }

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

postmen.cpp: In function 'int32_t main()':
postmen.cpp:31:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen(Task".inp", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
postmen.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen(Task".out", "w", stdout);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
postmen.cpp:34: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:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &e[i].u, &e[i].v);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...