#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,l,r) for(int i=l; i<r; i++)
#define all(x) x.begin(),x.end()
#define len(x) (int)x.size();
#define fi first
#define se second
#define elif else if
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
constexpr ll LINF=1001001001001001001LL;
constexpr ll MINF=1001001001001LL;
constexpr int INF=1001001001;
int N;
vi riffle(vi p){
int lf=0;
int ri=N/2;
vi ret(N);
rep(i,N){
if(lf==N/2||(ri!=N&&p[lf]>p[ri])){
ret[i]=p[ri];
ri++;
}
else{
ret[i]=p[lf];
lf++;
}
}
return ret;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int Q;
cin>>N>>Q;
vi P(N);
rep(i,N)cin>>P[i];
rep(i,10000){
if(P==riffle(P))return 0;
P=riffle(P);
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3088 ms |
4188 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2425 ms |
2380 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |