# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238428 | lakshith_ | Gondola (IOI14_gondola) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
set<int> visited;
int valid(int n,int input[]){
for(int i=0;i<n;i++)
if(visited.find(input[i])!=visited.end())
return 0;
else
visited.insert(input[i]);
int start = -1;
for(int i=0;i<n;i++)if(input[i]<=n){
start = i;
break;
}
if(start==-1)return 1;
int next = input[start];
int pos = start;
for(int i=0;i<n;i++){
if(input[pos]<=n&&input[pos]!=next)return 0;
pos++;
if(pos>=n)pos=0;
next++;
if(next>n)next=1;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
// int MAX = 0;
// for(int i=0;i<n;i++){
// visited[gondolaSeq[i]]=true;
// MAX = max(MAX,gondolaSeq[i]);
// }
// int l = 0;
// for(int i=1;i<MAX;i++)
// if(!visited[i])replacementSeq[l++]=i;
// return l;
// }
// int countReplacement(int n, int inputSeq[]){
// return 0;
}
// int main(){
// while(true){
// int n;
// cin >> n;
// int arr[n];
// int temp[n];
// for(int i=0;i<n;i++)cin >> arr[i];
// cout << valid(n,arr) << "\n";
// }
// }