# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
65279 | 2018-08-07T09:43:11 Z | gnoor | Gondola (IOI14_gondola) | C++17 | 0 ms | 0 KB |
#include "gondola.h" #include <cmath> #include <cstdio> bool mark[300100]; int valid(int n, int inputSeq[]) { int key=-1; int id=-1; int cur; for (int i=0;i<n;i++) { inputSeq[i]--; if (mark[inputSeq[i]]) return 0; mark[inputSeq[i]]++; } for (int i=0;i<n;i++) { if (inputSeq[i]>=n) continue; key=inputSeq[i]; id=i; } for (int i=0;i<n;i++) { if (inputSeq[i]>=n) continue; cur=key+i-id; cur%=n; cur+=n; cur%=n; if (inputSeq[i]!=cur) return 0; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }