이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int correct[MAXN];
bool marc[3 * MAXN];
int valid(int n, int seq[])
{
int id = 0;
for(int i = 0; i < n; i++)
if(seq[i] <= n)
{ id = i; break; }
correct[id] = seq[id];
for(int i = id + 1; i < n; i++)
{
correct[i] = correct[i - 1] + 1;
if(correct[i] > n) correct[i] = 1;
}
for(int i = id - 1; i >= 0; i--)
{
correct[i] = correct[i + 1] - 1;
if(correct[i] < 1) correct[i] = n;
}
for(int i = 0; i < n; i++)
{
if(seq[i] <= n && correct[i] != seq[i]) return 0;
if(seq[i] > n && marc[seq[i]]) return 0;
marc[seq[i]] = true;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -1;
}
int countReplacement(int n, int inputSeq[])
{
return -1;
}
/*
int N, SEQ[MAXN];
int main ()
{
scanf("%d", &N);
for(int i = 0; i < N; i++) scanf("%d", &SEQ[i]);
printf("%d\n", valid(N, SEQ));
}
*/
# | 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... |