Submission #1251541

#TimeUsernameProblemLanguageResultExecution timeMemory
1251541nguyenletrungCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;

//int press(string x)
//{
//	return 1;
//}

string guess_sequence(int N)
{
	
	string ans="";
	
	if(press("AB")>0)
	{
		if(press("A")>0) ans="A";
		else ans="B";
	}
	else
	{
		if(press("X")>0) ans="X";
		else ans="Y";
	}
	
	vector<string> vv;
	vv.clear();
	if(ans=="A")
	{
		vv.pb("B");
		vv.pb("X");
		vv.pb("Y");
	}
	else
	if(ans=="B")
	{
		vv.pb("A");
		vv.pb("X");
		vv.pb("Y");
	}
	else
	if(ans=="X")
	{
		vv.pb("A");
		vv.pb("B");
		vv.pb("Y");
	}
	else
	if(ans=="Y")
	{
		vv.pb("A");
		vv.pb("B");
		vv.pb("X");
	}
	
	for(int i=1;i<=N-2;i++)
	{
		string x="";
		x=x+ans+vv[0]+vv[0];
		x=x+ans+vv[0]+vv[1];
		x=x+ans+vv[0]+vv[2];
		x=x+ans+vv[1];
		
		int val=press(x);
		
		if(val==i) ans=ans+vv[2];
		else
		if(val==i+1) ans=ans+vv[1];
		else ans=ans+vv[0];
	}
	
	press(ans);
	string x="";
	x=ans+vv[0]+ans+vv[1]+ans+vv[2];
	
	press(x);
	
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
	
	
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:12: error: 'press' was not declared in this scope
   18 |         if(press("AB")>0)
      |            ^~~~~
combo.cpp:67:25: error: 'press' was not declared in this scope
   67 |                 int val=press(x);
      |                         ^~~~~
combo.cpp:75:9: error: 'press' was not declared in this scope
   75 |         press(ans);
      |         ^~~~~
combo.cpp:81:1: warning: no return statement in function returning non-void [-Wreturn-type]
   81 | }
      | ^