Submission #107595

#TimeUsernameProblemLanguageResultExecution timeMemory
107595dfistricCop and Robber (BOI14_coprobber)C++14
16 / 100
44 ms1788 KiB
#include "coprobber.h" #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORd(i, a, b) for (int i = (a); i >= (b); i--) #define REP(i, n) FOR(i, 0, n) #define ll long long using namespace std; int strategy; int n; vector <int> ve[MAX_N]; int D[MAX_N], F[MAX_N]; int disc = -1; int P; void rek(int x, int p) { D[x] = ++disc; for (int y : ve[x]) { if (y == p) continue; rek(y, x); } F[x] = disc; return; } int start(int N, bool A[MAX_N][MAX_N]) { n = N; int e = 0; REP(i, n) { REP(j, n) { if (A[i][j]) ve[i].push_back(j), e++; } } e /= 2; if (e == n - 1) { rek(0, 0); strategy = 0, P = 0; return 0; } strategy = 1, P = 0; return 0; } int nextMove(int R) { if (strategy == 0) { for (int x : ve[P]) { if (D[x] < D[P]) continue; if (D[x] <= D[R] && F[R] <= F[x]) { P = x; return x; } } assert(0); } else if (strategy == 1) { } else { assert(0); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...