#include "grader.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(int N) {
vector<int> perm(N);
iota(perm.begin(), perm.end(), 1);
random_shuffle(perm.begin(), perm.end());
vector<bool> known(N, false);
int prv = -1;
for (int i = 0; i < N;) {
if (known[i]) {
i++;
continue;
}
int baseline = query(perm);
if (baseline == N) return;
int found = -1;
for (int j = i + 1; j < N; j++) {
swap(perm[i], perm[j]);
int pot = query(perm);
if (pot == N) return;
if (pot > baseline) {
found = j;
break;
}
swap(perm[i], perm[j]);
}
if (~found) {
if (~prv) known[prv] = true;
prv = found;
} else {
known[i] = true;
i++;
prv = -1;
}
}
query(perm);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 31 |
2 |
Correct |
1 ms |
204 KB |
Correct! Number of queries: 4 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 20 |
4 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 32 |
5 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 33 |
6 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 31 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 31 |
2 |
Correct |
1 ms |
204 KB |
Correct! Number of queries: 4 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 20 |
4 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 32 |
5 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 33 |
6 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 31 |
7 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1600 |
8 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1500 |
9 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1100 |
10 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1500 |
11 |
Correct |
16 ms |
200 KB |
Correct! Number of queries: 1000 |
12 |
Correct |
19 ms |
200 KB |
Correct! Number of queries: 1400 |
13 |
Correct |
21 ms |
204 KB |
Correct! Number of queries: 1300 |
14 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1400 |
15 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1500 |
16 |
Correct |
30 ms |
200 KB |
Correct! Number of queries: 1600 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 31 |
2 |
Correct |
1 ms |
204 KB |
Correct! Number of queries: 4 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 20 |
4 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 32 |
5 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 33 |
6 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 31 |
7 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1600 |
8 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1500 |
9 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1100 |
10 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1500 |
11 |
Correct |
16 ms |
200 KB |
Correct! Number of queries: 1000 |
12 |
Correct |
19 ms |
200 KB |
Correct! Number of queries: 1400 |
13 |
Correct |
21 ms |
204 KB |
Correct! Number of queries: 1300 |
14 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1400 |
15 |
Correct |
26 ms |
200 KB |
Correct! Number of queries: 1500 |
16 |
Correct |
30 ms |
200 KB |
Correct! Number of queries: 1600 |
17 |
Runtime error |
207 ms |
200 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |