# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397985 | prvocislo | 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 <iostream>
#include <vector>
#include <algorithm>
#include <set>
typedef long long ll;
using namespace std;
int valid(int n, int v[])
{
vector<int> o(n, -1);
for (int i = 0; i < n; i++) v[i]--;
set<int> s(v, v + n);
for (int i = 0; i < n; i++)
{
if (v[i] >= n) continue;
o[i] = v[i];
for (int j = 0; j < n; j++) o[j] = (v[i] - i + j + n) % n;
break;
}
if (s.size() != n) return 0;
for (int i = 0; i < n; i++) if (v[i] < n && o[i] != v[i]) return 0;
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return 0; }
int countReplacement(int n, int inputSeq[]) { return 0; }