Submission #396775

#TimeUsernameProblemLanguageResultExecution timeMemory
396775biggGondola (IOI14_gondola)C++14
20 / 100
12 ms1652 KiB
#include "gondola.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int freq[3*MAXN]; int nseq[2*MAXN]; int valid(int n, int inputSeq[]) { // int ult = 0; for(int i = 0; i < n; i++){ nseq[i+1] = nseq[i+n+1] = inputSeq[i]; freq[inputSeq[i]]++; if(freq[inputSeq[i]] == 2) return 0; } int ini = 0, auxi = n + 1; for(int i = 1; i <= n; i++){ if(nseq[i] <= n && nseq[i] < auxi) ini = i, auxi = nseq[i]; // printf("%d %d\n", nseq[i], auxi); } //printf("\n"); //printf("%d\n",ini); if(!ini) return 1; int ult = auxi, ultaux = ini; for(int i = ini+1; i < ini + n; i++){ if(nseq[i] <= n){ // printf("%d %d\n", nseq[i], ult ); if(nseq[i] <= ult ||nseq[i] - ult != i - ultaux) return 0; ult = nseq[i]; ultaux = i; } } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- 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...