# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138564 | Mahmoud_Adel | 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"
#include <bits/stdc++.h>
const int N = 1e6+5;
int valid(int n, int inputSeq[])
{
memset(mark, 0, sizeof mark);
for(int i=0; i<n; i++)
{
if(mark[inputSeq[i]]) return 0;
mark[inputSeq[i]] = 1;
}
int j = -1;
for(int i=0; i<n; i++) if(inputSeq[i] > 0 && inputSeq[i] <= n) j = i;
id(j == -1) return 1;
for(int i=0; i<n; i++)
{
int id = (i+j)%n, jd = (i+j+1)%n;
if(inputSeq[jd] > n) inputSeq[jd] = inputSeq[id]%n + 1;
if(inputSeq[jd] != inputSeq[id]%n + 1) return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}