# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164984 | kostia244 | 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>
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
int valid(int n, int a[])
{
vi v, b;
int x = n+1;
for(int i = 0; i < n; i++) {
if(a[i]<=n)
v.pb(a[i]), x = min(x, a[i]);
else
b.pb(a[i]);
}
sort(all(b));
for(int i =1;i<b.size();i++)if(b[i]==b[i-1]) return 0;
if(v.size()<2) return 1;
int i = 0;
while(v[i] != x) v.pb(v[i++]);
for(++i; i < v.size(); i++) {
if(v[i]<=v[i-1]) return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}