#include "monster.h"
#include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<int> Solve(int N) {
vector<int> v(N);
//bool b = Query(0, 1);
//for (int i = 0; i < N; i++)
// v[i] = i;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (Query(i, j))
v[i] = v[i] + 1;
else
v[j] = v[j] + 1;
}
}
int low = -1;
for (int i = 0; i < N; i++) {
if (v[i] == 1) {
if (low < 0) {
low = i;
}
else {
if (Query(low, i))
v[low] = 0;
else
v[i] = 0;
break;
}
}
}
int high = -1;
for (int i = 0; i < N; i++) {
if (v[i] == N - 2) {
if (high < 0) {
high = i;
}
else {
if (Query(i, high))
v[high] = N - 1;
else
v[i] = N - 1;
break;
}
}
}
/*for (int i = 0; i < N; i++)
printf("%d ", v[i]);
printf("\n");*/
return v;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 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 |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
0 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 |
0 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 |
147 ms |
200 KB |
Output is correct |
17 |
Correct |
175 ms |
200 KB |
Output is correct |
18 |
Correct |
163 ms |
200 KB |
Output is correct |
19 |
Correct |
175 ms |
200 KB |
Output is correct |
20 |
Correct |
179 ms |
200 KB |
Output is correct |
21 |
Correct |
0 ms |
200 KB |
Output is correct |
22 |
Correct |
0 ms |
200 KB |
Output is correct |
23 |
Correct |
0 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 |
138 ms |
200 KB |
Output is correct |
27 |
Correct |
0 ms |
200 KB |
Output is correct |
28 |
Correct |
0 ms |
200 KB |
Output is correct |
29 |
Correct |
0 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 |
168 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 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 |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
0 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 |
0 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 |
147 ms |
200 KB |
Output is correct |
17 |
Correct |
175 ms |
200 KB |
Output is correct |
18 |
Correct |
163 ms |
200 KB |
Output is correct |
19 |
Correct |
175 ms |
200 KB |
Output is correct |
20 |
Correct |
179 ms |
200 KB |
Output is correct |
21 |
Correct |
0 ms |
200 KB |
Output is correct |
22 |
Correct |
0 ms |
200 KB |
Output is correct |
23 |
Correct |
0 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 |
138 ms |
200 KB |
Output is correct |
27 |
Correct |
0 ms |
200 KB |
Output is correct |
28 |
Correct |
0 ms |
200 KB |
Output is correct |
29 |
Correct |
0 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 |
168 ms |
200 KB |
Output is correct |
33 |
Incorrect |
194 ms |
264 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
237 ms |
264 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |