| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360681 | nini_gvenetadze | Gondola (IOI14_gondola) | C++20 | 965 ms | 756 KiB |
#include<bits/stdc++.h>
using namespace std;
#include "gondola.h"
int valid(int n, int inputseq[])
{
for(int i=0; i<n; i++)
{
for(int j=i+1; j<n; j++)
{
if(inputseq[i]==inputseq[j])
{
return 0;
}
}
}
int k=-1;
int c=-1;
for(int i=0; i<n; i++)
{
if(inputseq[i]<=n)
{
if(c==-1)
{
c=inputseq[i];
k=i;
continue;
}
if(inputseq[i]==1)
{
c=inputseq[i];
k=i;
continue;
}
if(inputseq[i]-c!=i-k)
{
return 0;
}
c=inputseq[i];
k=i;
}
}
return 1;
}
int replacement(int n, int gondolaseq[], int replacementseq[])
{
int a[2*n];
int ans=0;
for(int i=0; i<n; i++)
{
a[i]=gondolaseq[i];
a[i+n]=gondolaseq[i];
}
vector<pair<int, int>> v;
int ind=-1;
for(int i=0; i<n; i++)
{
if(a[i]<=n)
{
ind=i;
int x=a[i];
for(int j=i; j<i+n; j++)
{
if(a[j]!=x)
{
v.push_back({a[j], x});
}
x++;
if(x>n) x=1;
}
break;
}
}
if(ind==-1)
{
for(int i=0; i<n; i++)
{
replacementseq[i]=i+1;
}
return n;
}
sort(v.begin(), v.end());
int k=n+1;
for(int i=0; i<(int)v.size(); i++)
{
replacementseq[ans++]=v[i].second;
while(k<v[i].first)
{
replacementseq[ans++]=k;
k++;
}
if(k==v[i].first) k++;
}
return ans;
}
int countReplacement(int n, int inputSeq[]){
return 0;
}| # | 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... | ||||
