# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
445582 | DavidDamian | 곤돌라 (IOI14_gondola) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
#define debug(x) std::cout << #x << " = " << x << '\n'
int valid(int n, int inputSeq[])
{
int firstPos = -1;
int correctNumber = 0;
for (int i = 0; i < n; i++) {
if (inputSeq[i] <= n && firstPos == -1) {
firstPos = i;
correctNumber = inputSeq[i];
}
if (firstPos != -1) {
if (inputSeq[i] <= n && correctNumber != inputSeq[i]) {
return 0;
}
correctNumber = (correctNumber == n)? 1 : correctNumber + 1;
}
}
int bucket[250005];
memset(bucket, 0, sizeof(bucket));
for (int i = 0; i < n; i++) {
if (bucket[inputSeq[i]] == 1)
return 0;
bucket[inputSeq[i]] = 1;
}
return 1;
}