# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722586 | Yell0 | 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>
using namespace std;
const int MOD=1e9+9;
int valid(int n,int inputSeq[]) {
int st=-1;
vector<int> ogIdx(n+2);
set<int> usedNew;
for(int i=0;i<n;++i) {
if(st<0&&inputSeq[i]<=n) {
st=i;
ogIdx[inputSeq[i]]=i;
for(int j=1;j<n;++j) ogIdx[(inputSeq[i]-1+j)%n+1]=j;
} else if(inputSeq[i]<=n) {
if(ogIdx[inputSeq[i]]!=i) return 0;
} else {
if(usedNew.count(inputSeq[i])) return 0;
usedNew.insert(inputSeq[i]);
}
}
return 1;
}