Submission #590871

#TimeUsernameProblemLanguageResultExecution timeMemory
590871NamnamseoStray Cat (JOI20_stray)C++17
15 / 100
55 ms16920 KiB
#include "Anthony.h" #include <bitset> #include <vector> using namespace std; using vi=vector<int>; namespace { const int maxn = int(2e4) + 10; int n; struct Edge { int l, r; } ev[maxn]; vector<int> es[maxn]; int par[maxn], pei[maxn]; int lev[maxn]; int col[maxn]; void bfs() { static int q[maxn]; static bitset<maxn> vis; int f = 0, t = 1; vis.set(0); while (f < t) { int x = q[f++]; for (int ei : es[x]) { int y = ev[ei].l + ev[ei].r - x; if (vis[y]) continue; vis.set(y); par[y] = x; pei[y] = ei; lev[y] = lev[x]+1; q[t++] = y; } } } vi Case1(int N, int M, vi U, vi V) { n = N; for (int i=0; i<M; ++i) { ev[i] = {U[i], V[i]}; es[U[i]].push_back(i); es[V[i]].push_back(i); } bfs(); for (int i=0; i<M; ++i) { int a = ev[i].l, b = ev[i].r; col[i] = min(lev[a], lev[b])%3; } return vi(col, col+M); } } // namespace vi Mark(int N, int M, int A, int B, vi U, vi V) { if (B == 0) return Case1(N, M, U, V); return {}; }
#include "Catherine.h" #include <vector> using namespace std; using vi=vector<int>; namespace { int A, B; int Move1(vi &y) { int oc = 0; for (int i=0; i<3; ++i) if (y[i]) ++oc; if (oc == 1) for (int i=0; i<3; ++i) if (y[i]) return i; int tmp = 0; for (int i=0; i<3; ++i) if (y[i]) tmp += i; tmp += 2; tmp *= 2; return tmp % 3; } } // namespace void Init(int A, int B) { ::A = A; ::B = B; } int Move(vi y) { if (B == 0) return Move1(y); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...