#include <bits/stdc++.h>
#include "monster.h"
using namespace std;
typedef long long ll;
namespace {
int n;
int cnt[1002];
}
vector<int> Solve(int N){
n = N;
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
if(Query(i, j)) cnt[i]++;
else cnt[j]++;
}
}
vector<int> vec;
for(int i=0; i<n; i++) vec.push_back(i);
sort(vec.begin(), vec.end(), [&](int x, int y){
return cnt[x] < cnt[y];
});
if(Query(vec[0], vec[1]) == 0) swap(vec[0], vec[1]);
if(Query(vec[n-1], vec[n-2])) swap(vec[n-1], vec[n-2]);
vector<int> idx (n);
for(int i=0; i<n; i++) idx[vec[i]] = i;
return idx;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 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 |
192 ms |
272 KB |
Output is correct |
17 |
Correct |
195 ms |
272 KB |
Output is correct |
18 |
Correct |
189 ms |
276 KB |
Output is correct |
19 |
Correct |
172 ms |
276 KB |
Output is correct |
20 |
Correct |
226 ms |
276 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 |
242 ms |
276 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 |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
213 ms |
320 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 |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 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 |
192 ms |
272 KB |
Output is correct |
17 |
Correct |
195 ms |
272 KB |
Output is correct |
18 |
Correct |
189 ms |
276 KB |
Output is correct |
19 |
Correct |
172 ms |
276 KB |
Output is correct |
20 |
Correct |
226 ms |
276 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 |
242 ms |
276 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 |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
213 ms |
320 KB |
Output is correct |
33 |
Incorrect |
282 ms |
272 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
300 ms |
276 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |