이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 ;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |