Submission #218859

#TimeUsernameProblemLanguageResultExecution timeMemory
218859Kenzo_1114Gondola (IOI14_gondola)C++17
10 / 100
18 ms1536 KiB
#include "gondola.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 100010; int correct[MAXN]; int valid(int n, int seq[]) { int id = 0; for(int i = 0; i < n; i++) if(seq[i] <= n) { id = i; break; } correct[id] = seq[id]; for(int i = id + 1; i < n; i++) { correct[i] = correct[i - 1] + 1; if(correct[i] > n) correct[i] = 1; } for(int i = id - 1; i >= 0; i--) { correct[i] = correct[i + 1] - 1; if(correct[i] < 1) correct[i] = n; } for(int i = 0; i < n; i++) if(seq[i] <= n && correct[i] != seq[i]) return 0; return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -1; } int countReplacement(int n, int inputSeq[]) { return -1; } /* int N, SEQ[MAXN]; int main () { scanf("%d", &N); for(int i = 0; i < N; i++) scanf("%d", &SEQ[i]); printf("%d\n", valid(N, SEQ)); } */
#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...