답안 #17242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17242 2015-11-10T13:35:37 Z erdemkiraz 곤돌라 (IOI14_gondola) C++
컴파일 오류
0 ms 0 KB
#include "gondola.h"

int valid(int n, int inputSeq[]) {
	int ind = -1, x = -1;
	for(int i = 0; i < n; i++) {
		if(inputSeq[i] <= n) {
			ind = i;
			x = inputSeq[i];
			break;
		}
	}
	if(ind == -1)
		return 1;
	for(int i = ind + 1; i < n; i++) {
		if(inputSeq[i] <= n and (x + i - ind - 1) % n + 1 != inputSeq[i])
			return 0;
	}
	set < int > s;
	for(int i = 0; i < n; i++)
		s.insert(inputSeq[i]);
	return s.size() == n;
}

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

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

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

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

Compilation message

gondola.cpp: In function ‘int valid(int, int*)’:
gondola.cpp:18:2: error: ‘set’ was not declared in this scope
  set < int > s;
  ^
gondola.cpp:18:8: error: expected primary-expression before ‘int’
  set < int > s;
        ^
gondola.cpp:20:3: error: ‘s’ was not declared in this scope
   s.insert(inputSeq[i]);
   ^
gondola.cpp:21:9: error: ‘s’ was not declared in this scope
  return s.size() == n;
         ^
gondola.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^