This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |