# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064617 | NemanjaSo2005 | Gondola (IOI14_gondola) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gondola.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+5;
int N,niz[maxn],niz2[maxn];
void adjust(){
int najm=1;
for(int i=1;i<=N;i++)
if(niz[i]<niz[najm])
najm=i;
for(int i=1;i<=N;i++){
if(i+najm-1<=N)
niz2[i]=niz[i+najm-1];
else
niz2[i]=niz[i+najm-N-1];
}
for(int i=1;i<=N;i++)
niz[i]=niz2[i];
}
int valid(int n, int inputSeq[]){
N=n;
for(int i=1;i<=N;i++)
niz[i]=inputSeq[i-1];
adjust();/*
for(int i=1;i<=N;i++)
cout<<niz[i]<<" ";
cout<<endl;*/
if(niz[1]>=N)
return 1;
int treba=niz[1];
for(int i=2;i<=N;i++){
treba++;
if(niz[i]>N)
continue;
if(niz[i]!=treba)
return 0;
}
return 1;
}