| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 73693 | arman_ferdous | Potemkin cycle (CEOI15_indcyc) | C++17 | 1073 ms | 6488 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;
const int N = 1e5+10;
vector<int> g[N];
int n, m, par[N];
int bfs(int s, int t, int del) {
	par[s] = del;
	par[del] = 0;
	queue<int> q; q.push(s);
	while(!q.empty()) {
		int u = q.front(); q.pop();
		for(int v : g[u]) if(par[v] == -1) {
			par[v] = u; q.push(v);
		}
	} return par[t] != -1;
}
vector<int> soln;
int main() {
	scanf("%d %d", &n, &m);
	for(int i = 0; i < m; i++) {
		int u, v; scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(int u = 1; u <= n; u++)
		sort(g[u].begin(),g[u].end());
	for(int x = 1; x <= n; x++) {
		for(int u : g[x]) for(int v : g[x]) {
			if(u != v && binary_search(g[u].begin(),g[u].end(),v) == false) {
				fill(par,par+n+1,-1);
				for(int i : g[x]) if(i != v && i != u) par[i] = 0;
				if(bfs(u,v,x)) {
					int cur = v;
					while(par[cur]) {
						soln.push_back(cur);
						cur = par[cur];
					} soln.push_back(cur);
					int sz = soln.size();
					for(int i = sz - 1; i >= 0; i--)
						printf("%d ", soln[i]);
					return 0;
				}
			}
		}
	} puts("no");
	return 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... | ||||
| # | 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... | ||||
