제출 #586200

#제출 시각아이디문제언어결과실행 시간메모리
586200SeDunion곤돌라 (IOI14_gondola)C++17
컴파일 에러
0 ms0 KiB
#include "gondola.h"
#include<iostream>

using namespace std;

int valid(int n, int inputSeq[]) {
	int id = -1;
	for (int i = 0 ; i < n ; ++ i) {
		if (inputSeq[i] <= n) id = i;
	}
	if (id == -1) return 1;
	int x = inputSeq[i];
	for (int i = 0 ; i + x <= n ; ++ i) {
		int j = (i + id) % n;
		if (inputSeq[j] != i + x) return 0;
	}
	for (int i = 0 ; i < x ; ++ i) {
		int j = (id - i + n) % n;
		if (inputSeq[j] != x - i) return 0;
	}
	return 1;
}

//----------------------

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

//----------------------

int countReplacement(int n, int inputSeq[])
{
  return -3;
}

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:12:19: error: 'i' was not declared in this scope
   12 |  int x = inputSeq[i];
      |                   ^