# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103565 | 2019-03-31T14:08:28 Z | SecretAgent007 | Gondola (IOI14_gondola) | C++17 | 0 ms | 0 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, vector<int> &inputSeq){ int index = 0; int num = n; vector< bool > visited(n+1); for(int i = 0; i < n; i++){ if(visited[inputSeq[i]]) return 0; visited[inputSeq[i]] = true; if(inputSeq[i] <= num){ num = inputSeq[i]; index = i; } } vector< int > check; vector< int > is; for(int i = index; i < n; i++){ if(inputSeq[i] <= n){ check.push_back(inputSeq[i]); is.push_back(inputSeq[i]); } } for(int i = 0; i < index; i++){ if(inputSeq[i] <= n){ check.push_back(inputSeq[i]); is.push_back(inputSeq[i]); } } sort(check.begin(), check.end()); if(check == is) return 1; return 0; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ } int countReplacement(int n, int inputSeq[]){ } /* int main(){ int n; cin >> n; vector< int > v(n); for(int i = 0; i < n; i++){ v[i] = i+1; } cout << valid(n,v) << endl; } */