제출 #1161211

#제출 시각아이디문제언어결과실행 시간메모리
1161211Aza콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string getfnl(string s){
	string p = s + 'A' + s + 'B';
	if(press(p) == N){
		if(press(s + 'A') == N)s += 'A';
		else s += 'B';
	}
	else{
		if(press(s + 'X') == N)s += 'X';
		else s += 'Y';
	}
	return s;
}
string guess_sequence(int N){
	string s = getfnl("");
	string g = "AXBY";
	ignid = -1;
	for(int i = 0; i < 4; i++){
		if(s[0] == g[i])ignid = i;
	}
	string rem;
	for(int i = 0; i < 4; i++){
		if(i == ignid)continue;
		rem += g[i];
	}
	if(size(s) == N)return s;
	for(int i = 2; i < N; i++){
		string p = s + rem[0] + s + rem[1] + rem[0] + s + rem[1] + rem[1] + s + rem[1] + rem[2];
		if(press(p) == i){
			s += rem[0];
		}
		else if(press(p) == i + 1){
			s += rem[1];
		}
		else{
			s += rem[2];
		}
	}
	string p = s + 'A' + s + 'B';
	if(press(p) == N){
		if(press(s + 'A') == N)s += 'A';
		else s += 'B';
	}
	else{
		if(press(s + 'X') == N)s += 'X';
		else s += 'Y';
	}
	return getfnl(s);
}
/*



*/

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

combo.cpp: In function 'std::string getfnl(std::string)':
combo.cpp:6:24: error: 'N' was not declared in this scope
    6 |         if(press(p) == N){
      |                        ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:9: error: 'ignid' was not declared in this scope; did you mean 'signed'?
   19 |         ignid = -1;
      |         ^~~~~
      |         signed