제출 #591610

#제출 시각아이디문제언어결과실행 시간메모리
591610Morisz10콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
#include <string>
using namespace std;

string guess_sequence(int N) {
	string chr = "ABXY";
	int a = press("AB");
	if (a) {
		a = press("A");
		if (!a)swap(chr[0], chr[1]);
	}
	else {
		a = press("X");
		if(a) swap(chr[0], chr[2]);
		else swap(chr[0], chr[3]);
	}
	string s = "";
	s += chr[0];
	while (s.length() < N - 1) {
		int x = press(s + chr[2] + s + chr[3] + chr[1] + s + chr[3] + chr[2] + s + chr[3] + chr[3]);
		s += chr[x - s.length() + 1];
	}
	if (N == 1)return s;
	if (press(s + chr[1]) == N)return s + chr[1];
	if (press(s + chr[2]) == N)return s + chr[2];
	return s + chr[3];
}
/*
int main()
{

}
*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:10: error: 'press' was not declared in this scope
    8 |  int a = press("AB");
      |          ^~~~~
combo.cpp:20:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |  while (s.length() < N - 1) {
      |         ~~~~~~~~~~~^~~~~~~