# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582229 | kamelfanger83 | Gondola (IOI14_gondola) | C++14 | 13 ms | 620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include "gondola.h"
#include <limits>
#include <numeric>
#include <algorithm>
using namespace std;
int valid(int n, int inputSeq[]){
int one = numeric_limits<int>::min();
vector<bool> used (250001, false);
for(int c = 0; c < n; c++){
if(inputSeq[c] <= n){
if(one == numeric_limits<int>::min()) one = c - inputSeq[c] + 1;
if((c - one + 1) % n != inputSeq[c] % n) return 0;
}
else{
if(used[inputSeq[c]]) return 0;
used[inputSeq[c]] = true;
}
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
int one = 1;
for(int c = 0; c < n; c++){
if(gondolaSeq[c] <= n) one = c - gondolaSeq[c] + 1;
}
vector<int> ind (n); iota(ind.begin(), ind.end(), 0);
auto gcomp = [&](int u, int v){return gondolaSeq[u] < gondolaSeq[v];};
sort(ind.begin(), ind.end(), gcomp);
int repg = n;
int l = 0;
for(int rep : ind){
while(repg < gondolaSeq[rep]){
replacementSeq[l++] = (rep - one + 1 + n) % n;
repg++;
}
}
return l;
}
int countReplacement(int n, int inputSeq[]){
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |