#include <bits/stdc++.h>
#include <monster.h>
using namespace std;
bool Query(int a, int b);
std::vector<int> Solve(int N) {
vector<int> T(N);
if(N == 1) return T;
vector<int> win(N);
for(int i = 0; i < N; i++) {
for(int j = i + 1; j < N; j++) {
if(Query(i, j)) ++win[i];
else ++win[j];
}
}
for(int i = 0; i < N; i++) {
if(win[i] < N - 2 && win[i] > 1)
T[i] = win[i];
}
if(N == 2) {
for(int i = 0; i < N; i++)
T[i] = 1 - win[i];
return T;
}
for(int i = 0; i < N; i++) {
for(int j = i + 1; j < N; j++) {
if(win[i] == 1 && win[j] == 1) {
if(Query(i, j))
T[i] = 0, T[j] = 1;
else
T[i] = 1, T[j] = 0;
}
}
}
for(int i = 0; i < N; i++) {
for(int j = i + 1; j < N; j++) {
if(win[i] == N - 2 && win[j] == N - 2)
if(Query(i, j))
T[i] = N - 2, T[j] = N - 1;
else
T[i] = N - 1, T[j] = N - 2;
}
}
return T;
}
Compilation message
monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:38:15: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
38 | if(win[i] == N - 2 && win[j] == N - 2)
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
0 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 |
168 ms |
200 KB |
Output is correct |
17 |
Correct |
149 ms |
200 KB |
Output is correct |
18 |
Correct |
183 ms |
200 KB |
Output is correct |
19 |
Correct |
154 ms |
200 KB |
Output is correct |
20 |
Correct |
216 ms |
200 KB |
Output is correct |
21 |
Correct |
0 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 |
197 ms |
200 KB |
Output is correct |
27 |
Correct |
1 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 |
2 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
203 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
0 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 |
168 ms |
200 KB |
Output is correct |
17 |
Correct |
149 ms |
200 KB |
Output is correct |
18 |
Correct |
183 ms |
200 KB |
Output is correct |
19 |
Correct |
154 ms |
200 KB |
Output is correct |
20 |
Correct |
216 ms |
200 KB |
Output is correct |
21 |
Correct |
0 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 |
197 ms |
200 KB |
Output is correct |
27 |
Correct |
1 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 |
2 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
203 ms |
200 KB |
Output is correct |
33 |
Incorrect |
221 ms |
288 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
232 ms |
284 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |