This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |