/*
Author : DeMen100ns (a.k.a Vo Khac Trieu)
School : VNU-HCM High school for the Gifted
fuck you adhoc
*/
#include <monster.h>
#include <bits/stdc++.h>
using namespace std;
namespace {
};
int check(int id, int n){
int ct = 0;
for(int i = 0; i < n; ++i){
if (id == i) continue;
ct += Query(id, i);
}
return ct;
}
std::vector<int> Solve(int n)
{
std::vector<int> v, ans(n);
v.push_back(0);
for(int i = 1; i < n; ++i){
int l = -1, r = v.size();
if (l + 1 < r){
int mid = (l + r) >> 1;
if (Query(i, v[mid])){
l = mid;
} else r = mid;
}
v.insert(v.begin() + r, i);
}
int ct = 0;
for(int i = 0; i < n; ++i){
if (check(v[i], n) == 1){
swap(v[ct], v[i]);
++ct;
}
if (ct == 2) break;
}
if (!Query(v[0], v[1])) swap(v[0], v[1]);
for(int i = 1; i < n - 1; ++i){
for(int j = i + 1; j < n; ++j){
if (Query(v[i], v[j])){
swap(v[i + 1], v[j]);
break;
}
}
}
for(int i = 0; i < n; ++i){
ans[v[i]] = i;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
199 ms |
208 KB |
Output is correct |
17 |
Correct |
160 ms |
208 KB |
Output is correct |
18 |
Correct |
100 ms |
208 KB |
Output is correct |
19 |
Correct |
179 ms |
208 KB |
Output is correct |
20 |
Correct |
173 ms |
208 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
1 ms |
208 KB |
Output is correct |
23 |
Correct |
1 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 |
8 ms |
208 KB |
Output is correct |
27 |
Correct |
1 ms |
208 KB |
Output is correct |
28 |
Correct |
1 ms |
208 KB |
Output is correct |
29 |
Correct |
1 ms |
208 KB |
Output is correct |
30 |
Correct |
1 ms |
208 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Incorrect |
172 ms |
296 KB |
Wrong Answer [6] |
33 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
199 ms |
208 KB |
Output is correct |
17 |
Correct |
160 ms |
208 KB |
Output is correct |
18 |
Correct |
100 ms |
208 KB |
Output is correct |
19 |
Correct |
179 ms |
208 KB |
Output is correct |
20 |
Correct |
173 ms |
208 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
1 ms |
208 KB |
Output is correct |
23 |
Correct |
1 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 |
8 ms |
208 KB |
Output is correct |
27 |
Correct |
1 ms |
208 KB |
Output is correct |
28 |
Correct |
1 ms |
208 KB |
Output is correct |
29 |
Correct |
1 ms |
208 KB |
Output is correct |
30 |
Correct |
1 ms |
208 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Incorrect |
172 ms |
296 KB |
Wrong Answer [6] |
33 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
232 ms |
296 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |