Submission #415837

#TimeUsernameProblemLanguageResultExecution timeMemory
415837LouayFarahGondola (IOI14_gondola)C++14
15 / 100
15 ms972 KiB
#include "bits/stdc++.h" #include "gondola.h" using namespace std; #define pb push_back int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return 1; } int countReplacement(int n, int inputSeq[]) { return 1; } vector<int> book; vector<int> r; int valid(int n, int inputSeq[]) { if(n==1) return 1; book.assign(n+1, 0); for(int i = 0; i<n; i++) { if(inputSeq[i]>n) { if(i==0) { if(inputSeq[n-1]==n) inputSeq[i] = 1; else if(inputSeq[n-1]<n) inputSeq[i] = inputSeq[n-1] + 1; } else { if(inputSeq[i-1]==n) inputSeq[i] = 1; else if(inputSeq[i-1]<n) inputSeq[i] = inputSeq[i-1] + 1; } continue; } book[inputSeq[i]]++; if(book[inputSeq[i]]>1) { return 0; } } int counter = 0; for(int i = 0; i<n; i++) { if(inputSeq[i]==1) { counter = i; break; } } int curr = 1; for(int k = 0; k<n; k++) { if(inputSeq[counter]!=curr) return 0; counter++; counter%=n; curr++; } return 1; }
#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...