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 ll long long
using namespace std;
const int maxn=1e5+5;
int N,niz[maxn],niz2[maxn];
set<int> S;
void adjust(){
int najm=1;
for(int i=1;i<=N;i++)
if(niz[i]<niz[najm])
najm=i;
for(int i=1;i<=N;i++){
if(i+najm-1<=N)
niz2[i]=niz[i+najm-1];
else
niz2[i]=niz[i+najm-N-1];
}
for(int i=1;i<=N;i++)
niz[i]=niz2[i];
}
int valid(int n, int inputSeq[]){
N=n;
for(int i=1;i<=N;i++){
niz[i]=inputSeq[i-1];
}
for(int i=1;i<=N;i++){
if(S.find(niz[i])!=S.end())
return 0;
S.insert(niz[i]);
}
S.clear();
adjust();/*
for(int i=1;i<=N;i++)
cout<<niz[i]<<" ";
cout<<endl;*/
if(niz[1]>=N)
return 1;
int treba=niz[1];
for(int i=2;i<=N;i++){
treba++;
if(niz[i]>N)
continue;
if(niz[i]!=treba)
return 0;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |