# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
400977 | Dan4Life | Gondola (IOI14_gondola) | C++17 | 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 "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, vector<int> a)
{
int sm = INT_MAX, pos = -1;
map<int,int> M; M.clear();
for(auto u : a)
{
M[u]++;
if(M[u]>=2)return 0;
}
for(int i = 0; i < n; i++)
if(sm>a[i] and a[i]<=n)sm=a[i], pos=i;
if(sm==INT_MAX)return 1;
int x = n;
while(x--){
if(a[pos]==n and a[(pos+1)%n]<=n and a[(pos+1)%n]!=1)return 0;
else if(a[pos]<n and a[(pos+1)%n]<=n and a[pos]!=a[(pos+1)%n]-1)
return 0;
pos++, pos%=n;
}
return 1;
}
int replacement(int n, vector<int> gondolaSeq, vector<int> replacementSeq)
{
}
int countReplacement(int n, vector<int> inputSeq)
{
}