# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
285527 | emanIaicepsa | 곤돌라 (IOI14_gondola) | C++14 | 15 ms | 640 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 "gondola.h"
#include<bits/stdc++.h>
using namespace std;
int valid(int n, int inputSeq[]){
for(int i=0;i<n;i++) inputSeq[i]--;
vector<bool> used(250000);
int pos0 = -1;
for(int i=0;i<n;i++){
if(inputSeq[i] < n) pos0 = (i - inputSeq[i] + n) % n;
if(used[inputSeq[i]]) return 0;
used[inputSeq[i]] = 1;
}
if(pos0 == -1) return 1;
for(int i=0;i<n;i++){
if(inputSeq[i] < n){
if((pos0 + inputSeq[i]) % n != i) return 0;
}
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
vector<bool> used(250000);
int mx = 0;
for(int i=0;i<n;i++) gondolaSeq[i]--, used[gondolaSeq[i]] = 1, mx = max(mx, gondolaSeq[i]);
int pos0 = -1, ans = 0;
for(int i=0;i<n;i++){
if(gondolaSeq[i] < n) pos0 = (i - gondolaSeq[i] + n) % n;
}
for(int i=0;i<mx;i++) if(!used[i]) replacementSeq[ans++] = i+1;
return ans;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
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... |