#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=i+1; 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: 19 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 7 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 15 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 22 |
5 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 22 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 18 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 19 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 7 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 15 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 22 |
5 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 22 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 18 |
7 |
Correct |
12 ms |
344 KB |
Correct! Number of queries: 1300 |
8 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1300 |
9 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
10 |
Correct |
10 ms |
344 KB |
Correct! Number of queries: 1300 |
11 |
Correct |
4 ms |
344 KB |
Correct! Number of queries: 800 |
12 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
13 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
14 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1200 |
15 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1200 |
16 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1300 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 19 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 7 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 15 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 22 |
5 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 22 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 18 |
7 |
Correct |
12 ms |
344 KB |
Correct! Number of queries: 1300 |
8 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1300 |
9 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
10 |
Correct |
10 ms |
344 KB |
Correct! Number of queries: 1300 |
11 |
Correct |
4 ms |
344 KB |
Correct! Number of queries: 800 |
12 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
13 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1100 |
14 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1200 |
15 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1200 |
16 |
Correct |
8 ms |
344 KB |
Correct! Number of queries: 1300 |
17 |
Runtime error |
96 ms |
424 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |