# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
374532 | vishesh312 | 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;
#include "gondola.h"
int valid(int n, int arr[]) {
map<int, bool> mp;
vector<int> v(arr, arr+n);
auto it = min_element(v.begin(), v.end());
rotate(v.begin(), it, v.end());
for (int i = 0; i < n; ++i) {
if (mp[v[i]]) return 0;
mp[v[i]] = true;
if (v[i] <= n and i != v[i] - v[0]) return 0;
}
return 1;
}