# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422385 | Andyvanh1 | 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 <bits/stdc++.h>
#include "gondola.h"
using namespace std;
#define vt vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for(int (i) = 0; (i) < (x); (i)++ )
typedef long long ll;
typedef long double ld;
typedef vt<int> vi;
typedef pair<int,int> pii;
int x[100005];
int valid(int n, int inputSeq[]){
int at = -1;
rep(i,n)x[i] = inputSeq[i];
sort(x,x+n);
for(int i = 1; i < n; i++){
if(x[i]==x[i-1])return 0;
}
for(int i = 0; i < n; i++){
if(inputSeq[i]>=n){
inputSeq[i] = -1;
}else{
at = i;
}
}
if(at==-1)return 1;
bool bol = true;
for(int i = at; i < n; i++){
if(inputSeq[i]!=-1&&inputSeq[i]!=(inputSeq[at]+i-at)%n){
return 0;
}
}
for(int i = 0; i < n; i++){
if(inputSeq[i]!=-1&&inputSeq[i]!=(inputSeq[at]-at+i+n)%n){
return 0;
}
}
return 1;
}