#include "monster.h"
#include <bits/stdc++.h>
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif
std::vector<int>
Solve(int N)
{
std::vector<int> T(N);
vector<int> winns(N);
vector<vector<bool>> answs(N, vector<bool>(N, false));
for (int i = 0; i < N; i++)
for (int e = 0; e < i; e++)
{
bool b = Query(i, e);
winns[b ? i : e]++;
answs[i][e] = b;
answs[e][i] = !b;
}
vector<int> l, f;
for (int i = 0; i < N; i++)
{
if (winns[i] == 1)
f.push_back(i);
else if (winns[i] == N - 2)
l.push_back(i);
else
T[i] = winns[i];
}
if (answs[l[1]][l[0]])
swap(l[0], l[1]);
T[l[0]] = N - 2;
T[l[1]] = N - 1;
if (answs[f[1]][f[0]])
swap(f[0], f[1]);
T[f[0]] = 0;
T[f[1]] = 1;
return T;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
1 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
200 KB |
Output is correct |
16 |
Correct |
215 ms |
200 KB |
Output is correct |
17 |
Correct |
152 ms |
200 KB |
Output is correct |
18 |
Correct |
214 ms |
200 KB |
Output is correct |
19 |
Correct |
219 ms |
200 KB |
Output is correct |
20 |
Correct |
233 ms |
200 KB |
Output is correct |
21 |
Correct |
1 ms |
200 KB |
Output is correct |
22 |
Correct |
1 ms |
200 KB |
Output is correct |
23 |
Correct |
1 ms |
200 KB |
Output is correct |
24 |
Correct |
1 ms |
200 KB |
Output is correct |
25 |
Correct |
1 ms |
200 KB |
Output is correct |
26 |
Correct |
143 ms |
200 KB |
Output is correct |
27 |
Correct |
0 ms |
200 KB |
Output is correct |
28 |
Correct |
1 ms |
200 KB |
Output is correct |
29 |
Correct |
1 ms |
200 KB |
Output is correct |
30 |
Correct |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
216 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
1 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
200 KB |
Output is correct |
16 |
Correct |
215 ms |
200 KB |
Output is correct |
17 |
Correct |
152 ms |
200 KB |
Output is correct |
18 |
Correct |
214 ms |
200 KB |
Output is correct |
19 |
Correct |
219 ms |
200 KB |
Output is correct |
20 |
Correct |
233 ms |
200 KB |
Output is correct |
21 |
Correct |
1 ms |
200 KB |
Output is correct |
22 |
Correct |
1 ms |
200 KB |
Output is correct |
23 |
Correct |
1 ms |
200 KB |
Output is correct |
24 |
Correct |
1 ms |
200 KB |
Output is correct |
25 |
Correct |
1 ms |
200 KB |
Output is correct |
26 |
Correct |
143 ms |
200 KB |
Output is correct |
27 |
Correct |
0 ms |
200 KB |
Output is correct |
28 |
Correct |
1 ms |
200 KB |
Output is correct |
29 |
Correct |
1 ms |
200 KB |
Output is correct |
30 |
Correct |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
216 ms |
200 KB |
Output is correct |
33 |
Incorrect |
209 ms |
460 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
222 ms |
460 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |