# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164199 | dantoh000 | 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>
using namespace std;
int valid(int n, int inputSeq[]) {
int anchor[n];
unordered_set<int> s;
int last = -1;
for (int i = 0; i < n; i++){
s.insert(inputSeq[i]);
if (inputSeq[i] > n) continue;
anchor[i] = (i+n-inputSeq[i])%n;
printf("%d ",anchor[i]);
if (last == -1){
last = anchor[i];
}
else{
if (last != anchor[i]) return 0;
}
}
if (s.size() != n) return 0;
return 1;
}