Submission #792242

#TimeUsernameProblemLanguageResultExecution timeMemory
792242MODDIGondola (IOI14_gondola)C++17
25 / 100
10 ms596 KiB
#include "gondola.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef pair<long long, long long> pll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<ll> vl; int valid(int n, int inputSeq[]) { int pos = -1; for(int i = 0; i < n; i++){ if(inputSeq[i] == 1){ pos = i; break; } } bool seq = true; int at = 1, lim = pos; while(pos < n){ if(inputSeq[pos] == at){ pos++; at++; } else{ seq = false; break; } } if(!seq) return 0; pos = 0; while(pos < lim){ if(inputSeq[pos] == at){ pos++; at++; } else{ seq = false; break; } } if(!seq) return 0; return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { vi arr; for(int i = 0; i < n; i++){ arr.pb(gondolaSeq[i]); } sort(arr.begin(), arr.end()); int j = 0, at = 1, rez = 0; for(int i = 0; i < (int)arr.size(); i++){ while(at < arr[i]){ replacementSeq[j++] = at++; rez++; } at++; } return rez; } //---------------------- 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...