#include "koala.h"
#include <vector>
#include <cstdio>
std::vector<bool> query(const std::vector<int> &vec)
{
static int B[105], R[105];
int n = vec.size();
for (int i = 0; i < n; i++)
B[i] = vec[i];
playRound(B, R);
std::vector<bool> res(n);
for (int i = 0; i < n; i++)
res[i] = R[i] > B[i];
return res;
}
int get_max(int n, int m, std::vector<bool> &in)
{
int cnt = 0;
for (int i = 0; i < n; i++)
cnt += in[i];
while (cnt > 1)
{
int w = m / cnt;
std::vector<int> vec(n);
for (int i = 0; i < n; i++)
vec[i] = in[i] ? w : 0;
auto res = query(vec);
cnt = 0;
for (int i = 0; i < n; i++)
{
in[i] = in[i] & res[i];
cnt += in[i];
}
}
for (int i = 0; i < n; i++)
{
if (in[i])
return i;
}
return -1;
}
int minValue(int n, int m)
{
std::vector<int> vec(n);
vec[0] = 1;
auto res = query(vec);
for (int i = 0; i < n; i++)
{
if (!res[i])
return i;
}
return -1;
}
int maxValue(int n, int m)
{
std::vector<bool> in(n, true);
return get_max(n, m, in);
}
int greaterValue(int n, int m)
{
return 0;
}
void allValues(int n, int m, int *arr)
{
for (int i = 0; i < n; i++)
arr[i] = 0;
for (int t = n; t; t--)
{
std::vector<bool> in(n);
for (int i = 0; i < n; i++)
in[i] = !arr[i];
arr[get_max(n, m, in)] = t;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
384 KB |
Output is correct |
2 |
Correct |
14 ms |
384 KB |
Output is correct |
3 |
Correct |
14 ms |
408 KB |
Output is correct |
4 |
Correct |
19 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
384 KB |
Output is correct |
2 |
Correct |
33 ms |
384 KB |
Output is correct |
3 |
Correct |
34 ms |
384 KB |
Output is correct |
4 |
Correct |
35 ms |
384 KB |
Output is correct |
5 |
Correct |
34 ms |
384 KB |
Output is correct |
6 |
Correct |
34 ms |
256 KB |
Output is correct |
7 |
Correct |
34 ms |
384 KB |
Output is correct |
8 |
Correct |
32 ms |
368 KB |
Output is correct |
9 |
Correct |
45 ms |
384 KB |
Output is correct |
10 |
Correct |
41 ms |
384 KB |
Output is correct |
11 |
Correct |
47 ms |
256 KB |
Output is correct |
12 |
Correct |
36 ms |
384 KB |
Output is correct |
13 |
Correct |
40 ms |
384 KB |
Output is correct |
14 |
Correct |
41 ms |
384 KB |
Output is correct |
15 |
Correct |
39 ms |
376 KB |
Output is correct |
16 |
Correct |
36 ms |
304 KB |
Output is correct |
17 |
Correct |
35 ms |
376 KB |
Output is correct |
18 |
Correct |
37 ms |
384 KB |
Output is correct |
19 |
Correct |
38 ms |
256 KB |
Output is correct |
20 |
Correct |
36 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |