# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1227831 | PlayVoltz | 곤돌라 (IOI14_gondola) | C++20 | 0 ms | 0 KiB |
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int ooga[100005];
void init(int n, int vect[]){
int a=0;
for (int i=0; i<n; ++i)if (vect[i]<=n){
a=(vect[i]-1-i+n)%n;
break;
}
for (int i=0; i<n; ++i)ooga[(i+a)%n]=vect[i];
for (int i=0; i<n; ++i)vect[i]=ooga[i];
}
int valid(int n, int vect[]){
set<int> s;
for (int i=0; i<n; ++i)s.insert(vect[i]);
if (a.size()!=n)return 0;
init(n, vect);
for (int i=0; i<n; ++i)if (vect[i]<n&&vect[i]-1!=i)return 0;
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}