답안 #218860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
218860 2020-04-02T21:33:27 Z Kenzo_1114 곤돌라 (IOI14_gondola) C++17
20 / 100
21 ms 1536 KB
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100010;

int correct[MAXN];
bool marc[3 * MAXN];

int valid(int n, int seq[])
{
	int id = 0;
	for(int i = 0; i < n; i++)
		if(seq[i] <= n)
		{	id = i; break;	}

	correct[id] = seq[id];
	for(int i = id + 1; i < n; i++)
	{	
		correct[i] = correct[i - 1] + 1;
		if(correct[i] > n)	correct[i] = 1;
	}

	for(int i = id - 1; i >= 0; i--)
	{
		correct[i] = correct[i + 1] - 1;
		if(correct[i] < 1)	correct[i] = n;
	}

	for(int i = 0; i < n; i++)
	{
		if(seq[i] <= n && correct[i] != seq[i])	return 0;
		if(seq[i] > n && marc[seq[i]])	return 0;
		marc[seq[i]] = true;
	}

	return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
	return -1;
}

int countReplacement(int n, int inputSeq[])
{
	return -1;
}
/*
int N, SEQ[MAXN];

int main ()
{
	scanf("%d", &N);

	for(int i = 0; i < N; i++)	scanf("%d", &SEQ[i]);

	printf("%d\n", valid(N, SEQ));
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 10 ms 640 KB Output is correct
7 Correct 21 ms 1024 KB Output is correct
8 Correct 15 ms 896 KB Output is correct
9 Correct 8 ms 512 KB Output is correct
10 Correct 16 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 10 ms 640 KB Output is correct
7 Correct 17 ms 1024 KB Output is correct
8 Correct 14 ms 896 KB Output is correct
9 Correct 8 ms 512 KB Output is correct
10 Correct 16 ms 1152 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 288 KB Output is correct
13 Correct 10 ms 888 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 19 ms 1536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 256 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -