제출 #292760

#제출 시각아이디문제언어결과실행 시간메모리
292760TMJN곤돌라 (IOI14_gondola)C++17
25 / 100
19 ms1280 KiB
#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;j++){ if(!P[j]){ replacementSeq[c]=t; t=j; } else{ replacementSeq[c]=P[j]; } c++; } } } return mx-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...