#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
void solve(int n){
mt19937 rng(999);
int perm[n];
for(int i=0; i<n; i++) perm[i]=i+1;
shuffle(perm,perm+n,rng);
vector<int> adj[n];
vector<int> v;
for(int i=0; i<n; i++) v.push_back(perm[i]);
int x=query(v);
int done[n];
memset(done,0,sizeof(done));
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
swap(v[i],v[j]);
int y=query(v);
if(y==n) return;
if(y>x){
x=y;
continue;
}
swap(v[i],v[j]);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 29 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 13 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 25 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 43 |
5 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 43 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 28 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 29 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 13 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 25 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 43 |
5 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 43 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 28 |
7 |
Correct |
18 ms |
344 KB |
Correct! Number of queries: 2300 |
8 |
Correct |
15 ms |
344 KB |
Correct! Number of queries: 2300 |
9 |
Correct |
16 ms |
344 KB |
Correct! Number of queries: 2000 |
10 |
Correct |
16 ms |
344 KB |
Correct! Number of queries: 2300 |
11 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
12 |
Correct |
13 ms |
340 KB |
Correct! Number of queries: 1700 |
13 |
Correct |
18 ms |
344 KB |
Correct! Number of queries: 1800 |
14 |
Correct |
23 ms |
344 KB |
Correct! Number of queries: 2100 |
15 |
Correct |
14 ms |
344 KB |
Correct! Number of queries: 2100 |
16 |
Correct |
18 ms |
344 KB |
Correct! Number of queries: 2200 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 29 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 13 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 25 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 43 |
5 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 43 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 28 |
7 |
Correct |
18 ms |
344 KB |
Correct! Number of queries: 2300 |
8 |
Correct |
15 ms |
344 KB |
Correct! Number of queries: 2300 |
9 |
Correct |
16 ms |
344 KB |
Correct! Number of queries: 2000 |
10 |
Correct |
16 ms |
344 KB |
Correct! Number of queries: 2300 |
11 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
12 |
Correct |
13 ms |
340 KB |
Correct! Number of queries: 1700 |
13 |
Correct |
18 ms |
344 KB |
Correct! Number of queries: 1800 |
14 |
Correct |
23 ms |
344 KB |
Correct! Number of queries: 2100 |
15 |
Correct |
14 ms |
344 KB |
Correct! Number of queries: 2100 |
16 |
Correct |
18 ms |
344 KB |
Correct! Number of queries: 2200 |
17 |
Runtime error |
105 ms |
428 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |