제출 #396777

#제출 시각아이디문제언어결과실행 시간메모리
396777bigg곤돌라 (IOI14_gondola)C++14
25 / 100
13 ms1764 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[]) { for(int i = 0; i < n; i++){ nseq[i+1] = nseq[i+n+1] = gondolaSeq[i]; freq[gondolaSeq[i]]++; } if(freq[n+1] == 0) return 0; for(int i = 1; i <= n; i++){ if(freq[i] == 0) replacementSeq[0] = i; } return 1; } //---------------------- 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...