Submission #35993

#TimeUsernameProblemLanguageResultExecution timeMemory
35993funcsrPotemkin cycle (CEOI15_indcyc)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <fstream> #include <bitset> #include <cassert> #include <vector> #include <queue> #define rep(i, n) for (int i=0; i<(n); i++) #define INF 1145141919 #define all(x) x.begin(), x.end() #define pb push_back using namespace std; int N, M; bool G[1000][1000]; int A[1000], pre[1000]; signed main() { cin >> N >> M; rep(i, M) { int a, b; cin >> a >> b; a--, b--; G[a][b] = G[b][a] = true; } rep(s, N) { rep(i, N) A[i] = -1; queue<int> q; rep(t, N) if (G[s][t]) { pre[t] = s; A[t] = t; q.push(t); } while (!q.empty()) { int x = q.front(); q.pop(); rep(t, N) if (G[x][t]) { if (t == s) continue; if (A[t] == -1) { A[t] = A[x], pre[t] = x; q.push(t); } else { int a = A[x], b = A[t]; if (a == b || G[a][b]) continue; vector<int> left, right; while (x != s) { left.pb(x); x = pre[x]; } while (t != s) { right.pb(t); t = pre[t]; } reverse(all(right)); left.pb(s); for (int r : right) left.pb(r); for (int x : left) cout << x+1 << " "; cout << "\n"; return 0; } } } } cout << "no\n"; return 0; }

Compilation message (stderr)

indcyc.cpp: In function 'int main()':
indcyc.cpp:53:29: error: 'reverse' was not declared in this scope
           reverse(all(right));
                             ^