# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
638240 | Seb | Gondola (IOI14_gondola) | C++17 | 17 ms | 1236 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;
typedef long long ll;
int valid(int n, int inputSeq[]) {
ll i,mn=0,aux[n];
bool resp=true;
for (i=0;i<n;i++) {
aux[i] = inputSeq[i];
if (aux[mn]>aux[i]) mn = i;
}
sort(aux,aux+n);
for (i=0;i<n-1;i++) if (aux[i]==aux[i+1]) return 0;
for (i=mn;i<n;i++) if (inputSeq[i]<=n) {
if (inputSeq[i]!=i-mn+1) resp = false;
}
for (i=0;i<mn;i++) if (inputSeq[i]<=n) {
if (inputSeq[i]!=(n-mn)+i+1) resp = false;
}
if (resp==true) return 1;
else return 0;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
ll i,mx=0,aux=1,j=0,p=0;
sort(gondolaSeq,gondolaSeq+n);
mx = gondolaSeq[n-1];
while (aux<mx) {
while (aux==gondolaSeq[j]) aux++;
if (aux<mx) {
replacementSeq[p] = aux;
p++;
j++;
}
}
return mx-n;
}
//----------------------
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... |