이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int fix(int i)
{
int res = i % n;
if (res < 0)
res += n;
return res;
}
int right(int i)
{
return fix(i+1);
}
int valid(int nn, int v[])
{
set<int> numbers;
n = nn;
int mi = 0;
for (int i = 1; i < n; i++)
{
if (v[i] < v[mi])
mi = i;
if (numbers.find(v[i]) != numbers.end())
return 0;
numbers.insert(v[i]);
}
if (v[mi] > n)
return 1;
int si = fix(mi - v[mi] + 1);
if (v[si] != 1 && v[si] <= n)
return 0;
for (int j = right(si), i = 1; j != si; j=right(j))
if (v[j] != ++i && v[j] <= n)
return 0;
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return 0;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return 0;
}
# | 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... |