제출 #96582

#제출 시각아이디문제언어결과실행 시간메모리
96582jhnah917Combo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <vector>
using namespace std;
 
string guess_sequence(int n){
	string S;
	if(press("AB")){
		if(press("A")) S = "A";
		else S = "B";
	}else{
		if(press("X")) S = "X";
		else S = "Y";
	}
	
	vector<string> v;
	if(ret != "A") v.push_back("A");
	if(ret != "B") v.push_back("B");
	if(ret != "X") v.push_back("X");
	if(ret != "Y") v.push_back("Y");
	
	string p = v[0], q = v[1], r = v[2];
	
	for(int i=2; i<n; i++){
		int sz = S.size();
		int now = press(S+p+p + S+p+q + S+p+r + S+q);
		if(now == sz+2) S += p;
		else if(now == sz+1) S += q;
		else S += r;
	}
	
	if(n != 1){
		if(press(ret+p) > S.size()) S += p;
		else if(press(ret+q) > S.size()) S += q;
		else S += r;
	}
	
	return S;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:5: error: 'ret' was not declared in this scope
   16 |  if(ret != "A") v.push_back("A");
      |     ^~~
combo.cpp:17:5: error: 'ret' was not declared in this scope
   17 |  if(ret != "B") v.push_back("B");
      |     ^~~
combo.cpp:18:5: error: 'ret' was not declared in this scope
   18 |  if(ret != "X") v.push_back("X");
      |     ^~~
combo.cpp:19:5: error: 'ret' was not declared in this scope
   19 |  if(ret != "Y") v.push_back("Y");
      |     ^~~
combo.cpp:32:12: error: 'ret' was not declared in this scope
   32 |   if(press(ret+p) > S.size()) S += p;
      |            ^~~