# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
515921 | asadasdas | Gondola (IOI14_gondola) | C++14 | 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 <bits/stdc++.h>
#include <gondola.h>
using namespace std;
bool valid(int n, int inputseq[])
{
int index=-1;
vector<int> real(n);
for(int i=0; i<n; ++i)
if(inputseq[i]<=n)
{
real[i]=inputseq[i], index=i;
break;
}
if(index==-1)
return 1;
int cur=real[index];
cur=cur==n?1:cur+1;
for(int j=index+1; j!=index; j=(j+1)%n,cur=cur==n?1:cur+1)
if(inputseq[j]<=n && inputseq[j] !=cur)
return 0;
return 1;
}