# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
229325 | 2020-05-04T08:25:53 Z | osaaateiasavtnl | Gondola (IOI14_gondola) | C++14 | 0 ms | 0 KB |
#include "gondola.h" int valid(int n, int a[]) { set <int> ms; for (int i = 0; i < n; ++i) ms.insert(a[i]); if (ms.size() < n) return 0; int pos = -1; for (int i = 0; i < n; ++i) { if (a[i] <= n) { pos = i; break; } } if (pos == -1) return 1; else { for (int sh = 0; sh < n; ++sh) { int i = (pos + sh) % n; int val = a[pos] + sh; if (val > n) val -= n; if (a[i] <= n && a[i] != val) return 0; } return 1; } } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }