Submission #536497

#TimeUsernameProblemLanguageResultExecution timeMemory
536497KoDKoala Game (APIO17_koala)C++17
19 / 100
16 ms464 KiB
#include <bits/stdc++.h> #include "koala.h" using std::vector; using std::array; using std::pair; using std::tuple; int minValue(int N, int) { int B[100] = {}, R[100] = {}; B[0] = 1; playRound(B, R); for (int i = 1; i < N; ++i) { if (R[i] == 0) { return i; } } return 0; } int maxValue(int N, int W) { int B[100] = {}, R[100] = {}; vector<int> v(N); std::iota(v.begin(), v.end(), 0); while (v.size() > 1) { std::fill(B, B + N, 0); for (const int i : v) { B[i] = W / v.size(); } playRound(B, R); vector<int> next; for (const int i : v) { if (R[i] > B[i]) { next.push_back(i); } } v = std::move(next); } return v[0]; } int greaterValue(int, int) { // TODO: Implement Subtask 3 solution here. // You may leave this function unmodified if you are not attempting this // subtask. return 0; } void allValues(int N, int W, int *P) { if (W == 2*N) { // TODO: Implement Subtask 4 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } else { int B[100] = {}, R[100] = {}; auto dfs = [&](auto&& dfs, const int l, vector<int>&& v) -> void { if (v.size() == 1) { P[v[0]] = l; } else { std::fill(B, B + N, 0); const int w = std::min<int>(W / v.size(), std::sqrt(2 * l)); for (const int i : v) { B[i] = w; } playRound(B, R); vector<int> a, b; for (const int i : v) { (R[i] <= B[i] ? a : b).push_back(i); } dfs(dfs, l, std::move(a)); dfs(dfs, l + a.size(), std::move(b)); } }; vector<int> v(N); std::iota(v.begin(), v.end(), 0); dfs(dfs, 0, std::move(v)); } }
#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...