# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527675 | siewjh | Potemkin cycle (CEOI15_indcyc) | C++17 | 286 ms | 94688 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 <iostream>
#include <vector>
#include <cstring>
using namespace std;
const int MAXN = 1005, MAXR = 200'005;
int adjmat[MAXN][MAXN];
int vis[MAXR], p[MAXR];
pair<int, int> elist[MAXR];
vector<int> oadjlist[MAXN], adjlist[MAXR];
bool ans_found = 0;
void dfs(int x, int par) {
if (ans_found) return;
vis[x] = 2;
p[x] = par;
for (int nxt : adjlist[x]) {
if (!vis[nxt]) dfs(nxt, x);
else if (vis[nxt] == 2 && !ans_found) {
ans_found = 1;
for (int curr = x; curr != nxt; curr = p[curr]) cout << elist[curr].first << ' ';
cout << elist[nxt].first;
}
if (ans_found) return;
}
vis[x] = 1; // not useful anymore
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int nodes, edges; cin >> nodes >> edges;
memset(adjmat, -1, sizeof(adjmat));
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |