Submission #240462

#TimeUsernameProblemLanguageResultExecution timeMemory
240462karmaSenior Postmen (BOI14_postmen)C++14
55 / 100
549 ms65376 KiB
#include <bits/stdc++.h> #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) + 7; typedef pair<int, int> pii; struct TEdge { int u, v; bool del; } e[N]; int n, m, vis[N]; vector<int> st, ss, adj[N]; void euler(int u) { int i; while(adj[u].size()) { if(e[adj[u].back()].del) { adj[u].pop_back(); continue; } i = adj[u].back(); adj[u].pop_back(); e[i].del = 1; euler(e[i].u ^ e[i].v ^ u); } st.pb(u); } 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); } cin >> n >> m; for(int i = 1; i <= m; ++i) { cin >> e[i].u >> e[i].v; adj[e[i].u].pb(i); adj[e[i].v].pb(i); } euler(1); for(int x: st) { if(vis[x]) { while(ss.size()) { vis[n = ss.back()] = 0; cout << n << ' '; ss.pop_back(); if(n == x) break; } cout << '\n'; } vis[x] = 1; ss.pb(x); } }

Compilation message (stderr)

postmen.cpp: In function 'int32_t main()':
postmen.cpp:41: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:42: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);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...