# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
376693 | lakshith_ | 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 "gondola.h"
bool b[2500010];
int checkOnce(int n,int vec[]){
for(int i=0;i<n;i++)
if(b[vec[i]])return 0;
else b[vec[i]]=true;
return 1;
}
int valid(int n, int vec[])
{
if(!checkOnce(n,vec))return 0;
int MIN=INT_MAX,minI=0;
for(int i=0;i<n;i++)if(MIN>vec[i])MIN=vec[i],minI=i;
int p = MIN;
int pos = minI;
if(MIN>n)return 1;
for(int k=0;k<n;k++){
if(vec[pos]<=n && vec[pos]!=p)return 0;
pos++;
p++;
pos%=n;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}