#include<bits/stdc++.h>
#include "monster.h"
using namespace std;
vector<int> Solve(int n)
{
int i,j,f[205],ans2[205];
vector<int> a[205],ans,ansf;
for (i=0;i<n;i++) f[i]=0;
for (i=0;i<n;i++) for (j=i+1;j<n;j++)
if (Query(i,j)) f[i]++;else f[j]++;
for (i=0;i<n;i++) a[f[i]].push_back(i);
if (Query(a[1][0],a[1][1]))
{
ans.push_back(a[1][0]);
ans.push_back(a[1][1]);
}
else
{
ans.push_back(a[1][1]);
ans.push_back(a[1][0]);
}
for (i=2;i<n-2;i++) ans.push_back(a[i][0]);
if (Query(a[n-2][0],a[n-2][1]))
{
ans.push_back(a[n-2][0]);
ans.push_back(a[n-2][1]);
}
else
{
ans.push_back(a[n-2][1]);
ans.push_back(a[n-2][0]);
}
for (i=0;i<n;i++) ans2[ans[i]]=i;
for (i=0;i<n;i++) ansf.push_back(ans2[i]);
return ansf;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 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 |
1 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 |
147 ms |
280 KB |
Output is correct |
17 |
Correct |
158 ms |
280 KB |
Output is correct |
18 |
Correct |
179 ms |
280 KB |
Output is correct |
19 |
Correct |
146 ms |
300 KB |
Output is correct |
20 |
Correct |
174 ms |
284 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
1 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 |
150 ms |
284 KB |
Output is correct |
27 |
Correct |
0 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 |
Correct |
165 ms |
280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 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 |
1 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 |
147 ms |
280 KB |
Output is correct |
17 |
Correct |
158 ms |
280 KB |
Output is correct |
18 |
Correct |
179 ms |
280 KB |
Output is correct |
19 |
Correct |
146 ms |
300 KB |
Output is correct |
20 |
Correct |
174 ms |
284 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
1 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 |
150 ms |
284 KB |
Output is correct |
27 |
Correct |
0 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 |
Correct |
165 ms |
280 KB |
Output is correct |
33 |
Incorrect |
173 ms |
284 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
190 ms |
280 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |