Submission #1042158

#TimeUsernameProblemLanguageResultExecution timeMemory
1042158juicyStray Cat (JOI20_stray)C++17
15 / 100
29 ms16816 KiB
// https://www2.ioi-jp.org/camp/2020/2020-sp-tasks/day3/stray-review.pdf #include "Anthony.h" #include <bits/stdc++.h> using namespace std; namespace { void __print() { cerr << "]\n"; } template<class T, class... V> void __print(T t, V... v) { cerr << t; if (sizeof...(v)) { cerr << ", "; } __print(v...); } #ifdef LOCAL #define debug(x...) cerr << "[" << #x << "] = ["; __print(x); #else #define debug(...) 42 #endif vector<int> clr, dep; vector<vector<int>> g; string S = "010011"; } // namespace std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) { clr.resize(N); g.resize(N); dep.resize(N, -1); for (int i = 0; i < M; ++i) { int u = U[i], v = V[i]; g[u].push_back(v); g[v].push_back(u); } queue<int> q; dep[0] = 0; q.push(0); while (q.size()) { int u = q.front(); q.pop(); for (int v : g[u]) { if (dep[v] == -1) { dep[v] = dep[u] + 1; if (A == 2) { if (u == 0) { clr[v] = 0; } else if (g[u].size() == 2) { clr[v] = (clr[u] + 1) % 6; } else { clr[v] = S[clr[u]] == '0'; } } q.push(v); } } } vector<int> X(M); for (int i = 0; i < M; ++i) { int u = U[i], v = V[i]; if (dep[u] < dep[v]) { swap(u, v); } if (A == 2) { X[i] = S[clr[u]] - '0'; } else { X[i] = dep[v] % 3; } } return X; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; namespace { void __print() { cerr << "]\n"; } template<class T, class... V> void __print(T t, V... v) { cerr << t; if (sizeof...(v)) { cerr << ", "; } __print(v...); } #ifdef LOCAL #define debug(x...) cerr << "[" << #x << "] = ["; __print(x); #else #define debug(...) 42 #endif int A, B, lst = -1; bool up; string S; bool check() { for (int i = 0; i < 6; ++i) { if (string("010011010011").substr(i, 5) == S) { return 1; } } return 0; } } // namespace void Init(int A, int B) { ::A = A; ::B = B; } int Move(std::vector<int> y) { if (up) { return lst = find(y.begin(), y.end(), 1) - y.begin(); } auto g = y; if (~lst) { ++g[lst]; } int deg = 0, cnt = 0; for (int i = 0; i < A; ++i) { deg += g[i]; cnt += g[i] > 0; } if (A == 2) { if (deg == 2) { for (int i = 0; i < 2; ++i) { for (int j = 0; j < y[i]; ++j) { S += i + '0'; } } if (S.size() == 5) { up = 1; return check() ? -1 : lst = S.back() - '0'; } return lst = S.back() - '0'; } up = 1; int nxt = find(g.begin(), g.end(), 1) - g.begin(); return lst == nxt ? -1 : lst = nxt; } if (cnt == 1) { for (int i = 0; i < 3; ++i) { if (y[i]) { return lst = i; } } } if (lst == -1) { for (int i = 0; i < 3; ++i) { if (y[i] == 0) { return lst = (i + 1) % 3; } } } int nxt = lst == 0 ? 2 : lst - 1; assert(y[nxt]); return lst = nxt; }

Compilation message (stderr)

Anthony.cpp:10:8: warning: 'void {anonymous}::__print()' defined but not used [-Wunused-function]
   10 |   void __print() {
      |        ^~~~~~~

Catherine.cpp:8:8: warning: 'void {anonymous}::__print()' defined but not used [-Wunused-function]
    8 |   void __print() {
      |        ^~~~~~~
#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...