#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 |
Execution timed out |
1 ms |
256 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
256 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
256 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |