이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define debug(a) cerr << #a << " = " << a << endl
int visitados[250002];
int valid(int n, int inputSeq[])
{
int pos, val, a, dif;
bool res;
rep(i, 0, 250000) visitados[i] = 0;
pos = -1;
val = -1;
rep(i,0,n-1) {
if (inputSeq[i] <= n) {
pos = i;
val = inputSeq[i];
break;
}
}
if (pos == -1) return 1;
dif = pos - val;
debug(dif);
res = true;
rep(i,0,n-1) {
visitados[inputSeq[i]]++;
if (inputSeq[i] <= n) {
a = inputSeq[i] + dif;
a += n;
a %= n;
if (a != i) res = false;
}
if (visitados[inputSeq[i]] > 1){
res = false;
break;
}
}
if (res) return 1;
else return 0;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
int MAX,res,cont;
rep(i, 0, 250000) visitados[i] = 0;
MAX = 0;
rep(i,0,n-1){
visitados[gondolaSeq[i]] = 1;
MAX = max(MAX, gondolaSeq[i]);
}
res = MAX - n;
cont = 0;
rep (i,1,MAX-1) {
if (visitados[i] == 0) {
replacementSeq[cont] = i;
cont++;
}
}
return res;
}
//----------------------
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... |