/*
Author : DeMen100ns (a.k.a Vo Khac Trieu)
School : VNU-HCM High school for the Gifted
fuck you adhoc
*/
#include <monster.h>
namespace {
const int N = 1005;
bool f[N][N];
int cnt[N];
};
std::vector<int> Solve(int n)
{
for(int i = 0; i < n; ++i) cnt[i] = 0;
for(int i = 0; i < n; ++i){
for(int j = i + 1; j < n; ++j){
f[i][j] = Query(i, j);
cnt[i] += f[i][j];
cnt[j] += (!f[i][j]);
}
}
std::vector <int> ans(n);
int luu01 = -1, luu02 = -1, luun1 = -1, luun2 = -1;
for(int i = 0; i < n; ++i){
if (cnt[i] > 1 && cnt[i] < n - 1){
ans[i] = cnt[i];
}
if (cnt[i] == 1){
if (luu01 == -1) luu01 = i;
else luu02 = i;
}
if (cnt[i] == n - 2){
if (luun1 == -1) luun1 = i;
else luun2 = i;
}
}
//0 1 2 3 4 5
//1 1 2 3 4 4
ans[luu01] = ans[luu02] = 1;
if (f[luu01][luu02]) ans[luu01] = 0;
else ans[luu02] = 0;
ans[luun1] = ans[luun2] = n - 1;
if (f[luun1][luun2]) ans[luun1] = n - 2;
else ans[luun2] = n - 2;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
0 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
172 ms |
440 KB |
Output is correct |
17 |
Correct |
144 ms |
516 KB |
Output is correct |
18 |
Correct |
169 ms |
432 KB |
Output is correct |
19 |
Correct |
147 ms |
452 KB |
Output is correct |
20 |
Correct |
154 ms |
448 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
0 ms |
208 KB |
Output is correct |
24 |
Correct |
1 ms |
208 KB |
Output is correct |
25 |
Correct |
1 ms |
208 KB |
Output is correct |
26 |
Correct |
116 ms |
416 KB |
Output is correct |
27 |
Correct |
0 ms |
208 KB |
Output is correct |
28 |
Correct |
0 ms |
208 KB |
Output is correct |
29 |
Correct |
0 ms |
208 KB |
Output is correct |
30 |
Correct |
1 ms |
208 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
132 ms |
556 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
0 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
172 ms |
440 KB |
Output is correct |
17 |
Correct |
144 ms |
516 KB |
Output is correct |
18 |
Correct |
169 ms |
432 KB |
Output is correct |
19 |
Correct |
147 ms |
452 KB |
Output is correct |
20 |
Correct |
154 ms |
448 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
0 ms |
208 KB |
Output is correct |
24 |
Correct |
1 ms |
208 KB |
Output is correct |
25 |
Correct |
1 ms |
208 KB |
Output is correct |
26 |
Correct |
116 ms |
416 KB |
Output is correct |
27 |
Correct |
0 ms |
208 KB |
Output is correct |
28 |
Correct |
0 ms |
208 KB |
Output is correct |
29 |
Correct |
0 ms |
208 KB |
Output is correct |
30 |
Correct |
1 ms |
208 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
132 ms |
556 KB |
Output is correct |
33 |
Incorrect |
224 ms |
284 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
204 ms |
304 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |