#include "grader.h"
#include<bits/stdc++.h>
using namespace std ;
int n, num ;
vector<int> per, ans ;
void solve(int n){
for(int i = 1;i <= n ; ++ i){
ans.push_back(i) ;
}
for(int i = 0 ;i < n; ++ i){
// int x ; cin >> x ;
// per.push_back(x) ;
}
random_shuffle(ans.begin() , ans.end()) ;
srand(time(0)) ;
int tim = 0 ;
int las = 0 ;
while(tim ++ < 1000000){
int x = rand() % n ;
int y = rand() % n;
if(x == y)continue ;
swap(ans[x],ans[y]) ;
int now = query(ans) ;
if(now < las)swap(ans[x],ans[y]) ;
las = max(las , now) ;
if(now == n)
return ;
}
// return ;
if(las == n)
cout<<"ok " << num ;
else
cout<<"incorrect " ;
return ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 56 |
2 |
Correct |
0 ms |
256 KB |
Correct! Number of queries: 3 |
3 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 8 |
4 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 83 |
5 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 31 |
6 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 31 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 56 |
2 |
Correct |
0 ms |
256 KB |
Correct! Number of queries: 3 |
3 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 8 |
4 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 83 |
5 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 31 |
6 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 31 |
7 |
Correct |
62 ms |
256 KB |
Correct! Number of queries: 4000 |
8 |
Correct |
62 ms |
256 KB |
Correct! Number of queries: 4900 |
9 |
Correct |
61 ms |
256 KB |
Correct! Number of queries: 4200 |
10 |
Correct |
50 ms |
256 KB |
Correct! Number of queries: 3300 |
11 |
Correct |
32 ms |
256 KB |
Correct! Number of queries: 2500 |
12 |
Correct |
63 ms |
256 KB |
Correct! Number of queries: 3800 |
13 |
Correct |
57 ms |
256 KB |
Correct! Number of queries: 3500 |
14 |
Correct |
75 ms |
256 KB |
Correct! Number of queries: 5500 |
15 |
Correct |
75 ms |
256 KB |
Correct! Number of queries: 5000 |
16 |
Correct |
79 ms |
256 KB |
Correct! Number of queries: 4800 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 56 |
2 |
Correct |
0 ms |
256 KB |
Correct! Number of queries: 3 |
3 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 8 |
4 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 83 |
5 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 31 |
6 |
Correct |
1 ms |
256 KB |
Correct! Number of queries: 31 |
7 |
Correct |
62 ms |
256 KB |
Correct! Number of queries: 4000 |
8 |
Correct |
62 ms |
256 KB |
Correct! Number of queries: 4900 |
9 |
Correct |
61 ms |
256 KB |
Correct! Number of queries: 4200 |
10 |
Correct |
50 ms |
256 KB |
Correct! Number of queries: 3300 |
11 |
Correct |
32 ms |
256 KB |
Correct! Number of queries: 2500 |
12 |
Correct |
63 ms |
256 KB |
Correct! Number of queries: 3800 |
13 |
Correct |
57 ms |
256 KB |
Correct! Number of queries: 3500 |
14 |
Correct |
75 ms |
256 KB |
Correct! Number of queries: 5500 |
15 |
Correct |
75 ms |
256 KB |
Correct! Number of queries: 5000 |
16 |
Correct |
79 ms |
256 KB |
Correct! Number of queries: 4800 |
17 |
Execution timed out |
3004 ms |
256 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |