Submission #1014419

#TimeUsernameProblemLanguageResultExecution timeMemory
1014419rayan_bd콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N){
	string p="";
	if(press("A")==1) p="A";
	else if(press("B")==1) p="B";
	else if(press("Y")==1) p="Y";
	else p="X";

	if(N==1) return p;
	if(N>3) return "";

	queue<string> q;
	q.push(p);

	vector<string> choice={"A","B","X","Y"};

	while(q.size()){
		string last=q.front();q.pop();
		if(last.size()==N) return last;
		for(auto it:choice){
			if(it[0]!=last[0]&&press(last+it)==last.size()+1){
				q.push(last+it);
				break;
			}
		}
	}

	return p;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:5: error: 'press' was not declared in this scope
    6 |  if(press("A")==1) p="A";
      |     ^~~~~
combo.cpp:21:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |   if(last.size()==N) return last;
      |      ~~~~~~~~~~~^~~
combo.cpp:23:23: error: 'press' was not declared in this scope
   23 |    if(it[0]!=last[0]&&press(last+it)==last.size()+1){
      |                       ^~~~~