#pragma GCC optimize("Ofast")
#include "grader.h"
#include<stdio.h>
#include<algorithm>
#include<assert.h>
using namespace std;
int num[500];
bool check[500],wrong[500];
void solve(int n){
int i,j;
for(i=0;i<n;i++)
wrong[i]=check[i]=0;
vector<int> vec(n);
for(i=0;i<n;i++)
vec[i]=i+1;
random_shuffle(vec.begin(),vec.end());
int now=query(vec);
if(now==n)
return;
while(1){
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
if(check[i]||check[j])
continue;
swap(vec[i],vec[j]);
int v=query(vec);
if(v==n)
return;
if(v==now+2){
now+=2;
check[i]=check[j]=1;
break;
}
else if(v==now+1)
now++;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 15 |
2 |
Execution timed out |
3054 ms |
256 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 15 |
2 |
Execution timed out |
3054 ms |
256 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 15 |
2 |
Execution timed out |
3054 ms |
256 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |