# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17242 | 2015-11-10T13:35:37 Z | erdemkiraz | Gondola (IOI14_gondola) | C++ | 0 ms | 0 KB |
#include "gondola.h" int valid(int n, int inputSeq[]) { int ind = -1, x = -1; for(int i = 0; i < n; i++) { if(inputSeq[i] <= n) { ind = i; x = inputSeq[i]; break; } } if(ind == -1) return 1; for(int i = ind + 1; i < n; i++) { if(inputSeq[i] <= n and (x + i - ind - 1) % n + 1 != inputSeq[i]) return 0; } set < int > s; for(int i = 0; i < n; i++) s.insert(inputSeq[i]); return s.size() == n; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }