# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
387821 | MilosMilutinovic | 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.
/**
* author: milos
* created: 09.04.2021 10:49:32
**/
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int* a) {
set<int> s;
for (int i = 0; i < n; i++) {
a[i] %= n;
if (a[i] == 0) {
a[i] = n;
}
s.insert(a[i]);
}
if ((int) s.size() != n) {
return 0;
}
int cnt = 0;
for (int i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
cnt++;
}
}
return (cnt <= 1 ? 1 : 0);
}