# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
122685 | 2019-06-29T06:43:31 Z | brcode | Gondola (IOI14_gondola) | C++14 | 0 ms | 0 KB |
#include <iostream> #include <algorithm> #include <map> #include "gondola.h" using namespace std; int arr[2500]; int valid(int n, int inputSeq[]){ map<int,int> m1; int holdmin = 1e9; int ind = 0; for(int i=0;i<n;i++){ if(m1[inputSeq[i]] == 1){ return 0; } if(inputSeq[i]<holdmin){ holdmin = inputSeq[i]; ind = i; } m1[inputSeq[i]] = 0; } for(int i=ind;i<n;i++){ if(inputSeq[i]<=n && inputSeq[i]!=holdmin){ return 0; } holdmin++; } for(int i=1;i<holdmin;i++){ if(inputSeq[i]<=n && inputSeq[i]!=holdmin){ return 0; } holdmin++; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]); int countReplacement(int n, int inputSeq[]); /*int main(){ }*/