이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int inputSeq[]) {
int minx = (1 << 30), minid = -1; map<int, int>Map;
for (int i = 0; i < n; i++) { if (minx > inputSeq[i]) { minx = inputSeq[i]; minid = i; } if (Map[inputSeq[i]] == 1) return 0; Map[inputSeq[i]] = 1;}
for (int i = 0; i < n; i++) {
int s = (i + minid) % n;
if (inputSeq[s] <= n && inputSeq[s] != i + 1) return 0;
}
return 1;
}
//----------------------
int id[250009];
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
int G = 0; for (int i = 0; i < n; i++) { if (gondolaSeq[i] == 1) G = i; }
int maxn = 0;
for (int i = 0; i <= 250000; i++) id[i] = -1;
for (int i = 0; i < n; i++) { id[gondolaSeq[i]] = (i - G + n) % n; maxn = max(maxn, gondolaSeq[i]); }
for (int i = 0; i < n; i++) gondolaSeq[i] = i + 1;
for (int i = n + 1; i <= maxn; i++) {
if (id[i] >= 0) {
replacementSeq[i - (n + 1)] = gondolaSeq[id[i]];
gondolaSeq[id[i]] = i;
}
else {
replacementSeq[i - (n + 1)] = gondolaSeq[id[maxn]];
gondolaSeq[id[maxn]] = i;
}
}
return maxn - n;
}
//----------------------
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... |