# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1106742 | catashiro31 | Senior Postmen (BOI14_postmen) | C++17 | 287 ms | 81080 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>
#define endl '\n'
#define mod 1000000007
using namespace std;
vector<int> path;
void DFS(vector<pair<int,int>> adjList[], int u, vector<bool> &edge, vector<int> &visited) {
while (!adjList[u].empty()) {
int v = adjList[u].back().first;
int pos = adjList[u].back().second;
adjList[u].pop_back();
if (edge[pos]) continue;
edge[pos] = true;
DFS(adjList,v,edge,visited);
}
path.push_back(u);
visited[u]++;
if (visited[u] == 2) {
cout << u + 1 << " ";
path.pop_back();
while (path.back() != u) {
cout << path.back() + 1 << " ";
visited[path.back()]--;
path.pop_back();
}
visited[u] = 1;
cout << endl;
}
}
int main() {
ios_base::sync_with_stdio(false);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |