# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
521281 | sofapuden | Gondola (IOI14_gondola) | C++14 | 40 ms | 4564 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[]){
set<int> S;
int x = 0;
for(int i = 0; i < n; ++i){
if(S.count(inputSeq[i]))return 0;
S.insert(inputSeq[i]);
if(inputSeq[i] <= n)x = (inputSeq[i]-i+n-1)%(n)+1;
}
for(int i = 0; i < n; ++i){
if(inputSeq[i] != (x+i-1)%(n)+1 && inputSeq[i] <= n)return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
vector<pair<int,int>> v;
int x = 1;
for(int i = 0; i < n; ++i){
if(gondolaSeq[i] <= n)x = (gondolaSeq[i]-i+n-1)%(n)+1;
}
for(int i = 0; i < n; ++i){
if(gondolaSeq[i] > n){
v.emplace_back(gondolaSeq[i],(x+i-1)%n+1);
}
}
sort(v.begin(),v.end());
int cn = 0;
for(int i = 0; i < v.size(); ++i){
replacementSeq[cn++] = v[i].second;
while(cn + n < v[i].first){
replacementSeq[cn] = cn+n;
cn++;
}
}
return cn;
}
//----------------------
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... |