| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360568 | putuputu | Gondola (IOI14_gondola) | C++20 | 12 ms | 5364 KiB |
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;
int valid(int n, int inputSeq[])
{
unordered_set<int> se;
int d=-1, s=-1;
for(int i=0; i<n; i++){
if(se.count(inputSeq[i])==true){
return 0;
}
se.insert(inputSeq[i]);
if(inputSeq[i]<=n and d==-1){
d=i;
s=inputSeq[i];
}
}
if(d==-1){
return 1;
}
for(int i=0; i<n; i++){
if(inputSeq[i]<=n){
int ex=(s-1+(i-d))%n;
if(ex<0){
ex+=n;
}
ex+=1;
if(inputSeq[i]!=ex){
return 0;
}
}
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
if(valid(n, gondolaSeq)==0){
return -1;
}
vector<int> a(gondolaSeq, gondolaSeq+n);
sort(a.begin(), a.end());
int mx=a.back();
int l=0;
long long nw=1;
for(auto x : a){
while(nw<x){
replacementSeq[l++]=(int)nw;
nw++;
}
nw=(long long)x+1;
}
while(nw<=mx){
replacementSeq[l++]=(int)nw;
nw++;
}
return(l);
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
