#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] <= w ? a : b).push_back(i);
}
const int r = l + a.size();
dfs(dfs, l, std::move(a));
dfs(dfs, r, std::move(b));
}
};
vector<int> v(N);
std::iota(v.begin(), v.end(), 0);
dfs(dfs, 1, std::move(v));
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
4 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
208 KB |
Output is correct |
2 |
Correct |
12 ms |
320 KB |
Output is correct |
3 |
Correct |
12 ms |
312 KB |
Output is correct |
4 |
Correct |
11 ms |
312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
268 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
312 KB |
Output is correct |
4 |
Correct |
3 ms |
208 KB |
Output is correct |
5 |
Correct |
3 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
208 KB |
Output is correct |
7 |
Correct |
3 ms |
208 KB |
Output is correct |
8 |
Correct |
3 ms |
208 KB |
Output is correct |
9 |
Correct |
3 ms |
208 KB |
Output is correct |
10 |
Correct |
4 ms |
208 KB |
Output is correct |
11 |
Correct |
3 ms |
208 KB |
Output is correct |
12 |
Correct |
3 ms |
208 KB |
Output is correct |
13 |
Correct |
5 ms |
316 KB |
Output is correct |
14 |
Correct |
3 ms |
208 KB |
Output is correct |
15 |
Correct |
3 ms |
208 KB |
Output is correct |
16 |
Correct |
3 ms |
208 KB |
Output is correct |
17 |
Correct |
3 ms |
316 KB |
Output is correct |
18 |
Correct |
3 ms |
208 KB |
Output is correct |
19 |
Correct |
4 ms |
208 KB |
Output is correct |
20 |
Correct |
3 ms |
208 KB |
Output is correct |
21 |
Correct |
5 ms |
208 KB |
Output is correct |
22 |
Correct |
5 ms |
208 KB |
Output is correct |
23 |
Correct |
3 ms |
208 KB |
Output is correct |
24 |
Correct |
3 ms |
208 KB |
Output is correct |
25 |
Correct |
3 ms |
208 KB |
Output is correct |
26 |
Correct |
3 ms |
312 KB |
Output is correct |
27 |
Correct |
3 ms |
208 KB |
Output is correct |
28 |
Correct |
3 ms |
208 KB |
Output is correct |
29 |
Correct |
3 ms |
208 KB |
Output is correct |
30 |
Correct |
3 ms |
324 KB |
Output is correct |
31 |
Correct |
3 ms |
208 KB |
Output is correct |
32 |
Correct |
3 ms |
208 KB |
Output is correct |
33 |
Correct |
3 ms |
320 KB |
Output is correct |
34 |
Correct |
3 ms |
320 KB |
Output is correct |
35 |
Correct |
5 ms |
208 KB |
Output is correct |
36 |
Correct |
3 ms |
208 KB |
Output is correct |
37 |
Correct |
3 ms |
208 KB |
Output is correct |
38 |
Correct |
3 ms |
208 KB |
Output is correct |
39 |
Correct |
4 ms |
208 KB |
Output is correct |
40 |
Correct |
3 ms |
208 KB |
Output is correct |