# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131396 | DodgeBallMan | 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>
using namespace std;
int valid( int n, int num[] ) {
unordered_map<int,int> m;
int st = 0;
for( int i = 0 ; i < n ; i++ ) {
if( m[num[i]] > 0 ) return 0;
if( num[i] <= n && st == 0 ) st = num[i];
else if( num[i] <= n && st > 0 && st != num[i] ) return 0;
if( st != 0 ) st = ( st % n ) + 1;
}
return 1;
}