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 C[250001];
int valid(int n, int inputSeq[]){
int t=1;
for(int i=0;i<n;i++){
if(inputSeq[i]<=n){
for(int j=0;j<n;j++){
if(inputSeq[(i+j)%n]<=n){
if((inputSeq[i]+j)%n!=inputSeq[(i+j)%n]%n){
t=0;
}
}
}
break;
}
}
for(int i=0;i<n;i++){
if(C[inputSeq[i]])t=0;
C[inputSeq[i]]++;
}
return t;
}
int K[100000],P[250001];
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
int mx=0;
for(int i=0;i<n;i++){
mx=max(mx,gondolaSeq[i]);
}
for(int i=0;i<n;i++){
K[i]=i+1;
}
for(int i=0;i<n;i++){
if(gondolaSeq[i]<=n){
for(int j=0;j<n;j++){
K[(i+j)%n]=(gondolaSeq[i]+j)%n;
}
for(int j=0;j<n;j++){
if(!K[j])K[j]=n;
}
break;
}
}
for(int i=0;i<n;i++){
P[gondolaSeq[i]]=K[i];
}
for(int i=0;i<n;i++){
if(gondolaSeq[i]==mx){
int c=0;
int t=K[i];
for(int j=n+1;j<=mx-1;j++){
if(!P[j]){
replacementSeq[c]=t;
t=j;
}
else{
replacementSeq[c]=P[j];
}
c++;
}
replacementSeq[c]=t;
}
}
return mx-n;
}
//----------------------
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... |