# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
488448 | ntabc05101 | Senior Postmen (BOI14_postmen) | C++17 | 389 ms | 64332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define taskname ""
const int mxN = 500005;
int n, m;
vector< array<int, 2> > adj[mxN];
int nxt[mxN];
bool vis[mxN], used[mxN];
void dfs(int u) {
if (vis[u]) {
while (vis[u]) {
vis[u] = 0;
cout << 1 + u << " ";
u = nxt[u];
}
cout << "\n";
}
while (!adj[u].empty()) {
auto to = adj[u].back();
adj[u].pop_back();
if (!used[to[1]]) {
used[to[1]] = 1;
vis[u] = 1;
nxt[u] = to[0];
dfs(to[0]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |