# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017550 | 2024-07-09T08:47:36 Z | vivkostov | Gondola (IOI14_gondola) | C++14 | 0 ms | 0 KB |
#include<bits/stdc++.h> #define endl '\n' #include "gondola.h" using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n,a[200005],used[1000005]; int valid(int n,int seq[]) { int br=0; for(int i=1;i<=n;i++) { a[i]=seq[i-1]; } for(int i=1;i<=n;i++) { if(a[i]<=n) { if(!br)br=a[i]; else { if(a[i]!=br) { return 0; } } } if(used[a[i]]) { return 0; } used[a[i]]=1; if(br)br++; if(br>n)br=1; } for(int i=n+2;i<=250000;i++) { if(used[i]&&!used[i-1]) { return 0; } } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]); int countReplacement(int n, int inputSeq[]); /*int main() { speed(); read(); return 0; } */