Submission #260542

#TimeUsernameProblemLanguageResultExecution timeMemory
260542SaboonStray Cat (JOI20_stray)C++14
4 / 100
73 ms17316 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; const int maxn = 20'000 + 10; int h[maxn]; vector<int> g[maxn]; int Q[maxn], tail, head; void bfs(int v){ memset(h, -1, sizeof h); Q[head++] = v; h[v] = 0; while (tail < head){ v = Q[tail++]; for (auto u : g[v]) if (h[u] == -1) h[u] = h[v]+1, Q[head++] = u; } } vector<int> Mark(int n, int m, int A, int B, vector<int> U, vector<int> V) { vector<int> X(m); if (A >= 3){ for (int i = 0; i < m; i++){ g[U[i]].push_back(V[i]); g[V[i]].push_back(U[i]); } bfs(0); for (int i = 0; i < m; i++){ int v = V[i], u = U[i]; if (h[v] == h[u]) X[i] = h[v]%3; else X[i] = (min(h[v],h[u])+2)%3; } return X; } return X; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; int A, B; void Init(int a, int b) { A = a, B = b; } int Move(vector<int> y) { int a = -1, b = -1; for (int j = 0; j < A; ++j) { if (y[j] != 0){ if (a == -1) a = j; else b = j; } } if (b == -1) return a; if (a+1 == b) return a; return b; }
#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...