이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
// trans rights
#define ll long long
#define f first
#define s second
#define endl '\n'
#define all(x) begin(x), end(x)
int valid(int n, int inputSeq[])
{
int tmp = -1;
for (int i = 0; i < n; i++) {
if (inputSeq[i] <= n) {
int cur = (inputSeq[i] - i + n) % n;
if (tmp == -1) tmp = cur;
if (tmp != cur) return 0;
}
}
return 1;
}
//----------------------
int ori[100069];
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
int offst = 1;
pair<int,int> maxi = {0, -1};
for (int i = 0; i < n; i++) {
if (gondolaSeq[i] <= n) {
offst = gondolaSeq[i] - i;
}
maxi = max(maxi, {gondolaSeq[i], i});
}
for (int i = 0; i < n; i++) {
ori[i] = (i + offst + n) % n;
if (ori[i] == 0) ori[i] = n;
}
int l = maxi.f - n;
for (int i = 0; i < l; i++) {
replacementSeq[i] = -1;
}
for (int i = 0; i < n; i++) {
if (gondolaSeq[i] > n && gondolaSeq[i] != maxi.f) {
replacementSeq[gondolaSeq[i] - n - 1] = ori[i];
}
}
int cur = ori[maxi.s];
for (int i = 0; i < l; i++) {
if (!replacementSeq[i]) continue;
replacementSeq[i] = cur;
cur = i + n + 1;
}
return l;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# | 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... |