이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn=2.5e5+10;
bool imam[maxn];
int valid(int n, int inputSeq[]){
int tren=-1;
for(int i=0;i<n;i++){
if(imam[inputSeq[i]]) return 0;
imam[inputSeq[i]]=true;
if(inputSeq[i]>n){
if(tren!=-1) tren++;
continue;
}
if(tren==-1) tren=inputSeq[i];
else{
if(inputSeq[i]!=tren) return 0;
}
tren++;
if(tren>n) tren=1;
}
return 1;
}
//----------------------
int treba[maxn];
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
int l=0;
int tren=-1;
int maxi=INT_MIN;
for(int i=0;i<n;i++) maxi=max(maxi,gondolaSeq[i]);
for(int j=0;j<2*n;j++){
int i=j%n;
if(gondolaSeq[i]>n){
if(tren!=-1) treba[gondolaSeq[i]]=tren;
continue;
}
if(tren==-1) tren=gondolaSeq[i];
tren++;
if(tren>n) tren=1;
}
return l;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
/*
2
6
3 4 5 6 1 2
*/
# | 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... |