# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138717 | zoooma13 | Gondola (IOI14_gondola) | C++14 | 51 ms | 4740 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 "bits/stdc++.h"
#include "gondola.h"
using namespace std;
int valid(int n, int inputSeq[]){
int mi_idx = min_element(inputSeq ,inputSeq+n)-inputSeq;
set <int> ss;
for(int i=0; i<n; i++)
ss.insert(inputSeq[i]);
if(ss.size() != n)
return 0;
if(inputSeq[mi_idx] >= n)
return 1;
int nxt = inputSeq[mi_idx];
for(int i=mi_idx; nxt<=n; i++){
if(inputSeq[i%n] != nxt && inputSeq[i%n] <= n)
return 0;
nxt++;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
vector <pair<int ,int>> vii;
int mi_idx = min_element(gondolaSeq ,gondolaSeq+n)-gondolaSeq;
int nxt = gondolaSeq[mi_idx];
if(nxt > n)
nxt = 1;
for(int i=mi_idx; i<mi_idx+n; i++){
vii.push_back({gondolaSeq[i%n] ,nxt});
//cout << gondolaSeq[i%n] << ' ' << nxt << endl;
nxt = (nxt == n ? 1 : nxt+1);
}
sort(vii.begin() ,vii.end());
nxt = n;
vector <int> ret;
for(auto&p : vii){
if(p.first <= n)
continue;
ret.push_back(p.second);
for(nxt++; nxt != p.first; nxt++)
ret.push_back(nxt);
}
for(int i=0; i<ret.size(); i++)
replacementSeq[i] = ret[i];
return ret.size();
}
//----------------------
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... |