제출 #101822

#제출 시각아이디문제언어결과실행 시간메모리
101822iris2617Combo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<iostream>
#include<queue>
#include<algorithm>
#include<sstream>
#include<memory.h>
#include<vector>
using namespace std;
string guess_sequence(int N)
{
	int x,i;
	string s;
	char ch[4]={'A','B','X','Y'};
	if(press("AB")==1)
	{
		if(press("A")==1)
			x=1;
		else
			x=2;
	}
	else
	{
		if(press("C")==1)
			x=3;
		else
			x=4;
	}
	s+=ch[x];
	if(N==1)
		return s;
	swap(ch[x],ch[3]);
	for(i=1;i<N-1;i++)
	{
		x=press(s+ch[0]+ch[0]+s+ch[0]+ch[1]+s+ch[0]+ch[2]+s+ch[1]);
		if(x==i+2)
			s+=ch[0];
		else if(x==i+1)
			s+=ch[1];
		else
			s+=ch[2];
		
	}
	if(press(s+ch[0]+s+ch[1])==N)
	{
		if(press(s+ch[0])==N)
			s+=ch[0];
		else
			s+=ch[1];
	}
	else
		s+=ch[2];
	return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:5: error: 'press' was not declared in this scope
   13 |  if(press("AB")==1)
      |     ^~~~~
combo.cpp:33:5: error: 'press' was not declared in this scope
   33 |   x=press(s+ch[0]+ch[0]+s+ch[0]+ch[1]+s+ch[0]+ch[2]+s+ch[1]);
      |     ^~~~~
combo.cpp:42:5: error: 'press' was not declared in this scope
   42 |  if(press(s+ch[0]+s+ch[1])==N)
      |     ^~~~~