Submission #1102893

#TimeUsernameProblemLanguageResultExecution timeMemory
1102893alexander707070Gondola (IOI14_gondola)C++14
20 / 100
8 ms4600 KiB
#include<bits/stdc++.h> #include "gondola.h" #define MAXN 500007 using namespace std; int n; int s[MAXN],last,maxs,where[MAXN]; bool li[MAXN]; int valid(int N, int inputSeq[]){ n=N; int mins=1; for(int i=1;i<=n;i++){ s[i]=inputSeq[i-1]; s[i+n]=s[i]; if(s[i]<s[mins]){ mins=i; } } for(int i=mins;i<mins+n;i++){ if(s[i]<=n and s[i]!=s[mins]+i-mins)return 0; if(s[i]>n){ if(li[s[i]])return 0; li[s[i]]=true; } } return 1; } int replacement(int N, int gondolaSeq[], int replacementSeq[]){ n=N; maxs=1; for(int i=1;i<=n;i++){ s[i]=gondolaSeq[i-1]; if(s[i]>s[maxs])maxs=i; where[s[i]]=i; } for(int i=n+1;i<=maxs;i++){ if(where[i]==0){ replacementSeq[i-n-1]=maxs; }else{ replacementSeq[i-n-1]=where[i]; } } return maxs-n; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...