# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017615 | serkanrashid | Gondola (IOI14_gondola) | C++14 | 14 ms | 5740 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;
const int maxn = 1e5+5;
int n,a[maxn];
bool check_valid()
{
unordered_set<int>used;
int st = -1;
for(int i = 0; i < n; i++)
{
if(used.find(a[i])!=used.end()) return false;
used.insert(a[i]);
if(1<=a[i] && a[i] <= n) st = i;
}
if(st==-1) return true;
bool f = true;
int last = a[st];
int i = (st+1)%n;
while(i!=st)
{
last++;
if(last>n) last = 1;
if(1<=a[i] && a[i]<=n)
{
if(last!=a[i]) return false;
}
i = (i+1)%n;
}
return true;
}
int valid(int N, int inputSeq[])
{
n = N;
for(int i = 0; i < n; i++) a[i] = inputSeq[i];
return check_valid();
}
int replacement(int N, int gondolaSeq[], int replacementSeq[])
{
n = N;
}
int countReplacement(int N, int inputSeq[])
{
n = N;
for(int i = 0; i < n; i++) a[i] = inputSeq[i];
if(!check_valid()) return 0;
///OSHTE
}
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... |