# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296173 | arayi | 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 <bits/stdc++.h>
#include "grader.h"
#define ad push_back
using namespace std;
const int N = 3e5 + 20;
bool col[N];
int valid(int n, int inputSeq[])
{
vector <int> a;
for (int i = 0; i < n; i++) a.ad(inputSeq[i]);
for (int i = 0; i < n; i++) a.ad(inputSeq[i]);
int i1 = -1;
for (int i = 0; i < n; i++)
{
if(col[a[i]]) return 0;
col[a[i]] = true;
if(a[i] <= n)
{
i1 = (i - a[i] + 1 + n) % n;
}
}
if(i1 == -1) return 1;
for (int i = i1; i < i1 + n; i++)
{
if(a[i] > n) continue;
if(i - i1 + 1 != a[i]) return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}