Submission #138424

#TimeUsernameProblemLanguageResultExecution timeMemory
138424degeloCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB

using namespace std;
string a[4]; 
int first;
string s;
/*int press(string a){
	int resp;
	cout<<a;
	cin>>resp;
	return resp;
}*/
string guess_sequence(int n){
	a[0]="A",a[1]="B",a[2]="X",a[3]="Y";
	if(press(a[0]+a[1])>=1){
		if(press(a[0])==1){
			first=0;
			s+=a[0];
		}
		else{
			first=1;
			s+=a[1];	
		}
	}
	else{
		if(press(a[2])==1){
			first=2;
			s+=a[2];
		}
		else{
			first=3;
			s+=a[3];
		}
	}
	vector<string> b;
	for(int i=0;i<4;i++){
		if(i!=first) b.push_back(a[i]);
	}
	for(int i=1;i<n-1;i++){
		string st=s+b[0]+b[0]+s+b[0]+b[1]+s+b[0]+b[2]+s+b[1];
		int t=press(st);
		if(t==s.size()){
			s+=b[2];
		}
		if(t==s.size()+1){
			s+=b[1];
		}
		if(t==s.size()+2){
			s+=b[0];
		}
	}
	if(n>1){
		if(press(s+b[0])==n) s+=b[0];
		else if(press(s+b[1])==n) s+=b[1];
		else s+=b[2];	
	}
	return s; 
}
/*int main(){
	int n;
	cin>>n;
	guess_sequence(n);
}*/

Compilation message (stderr)

combo.cpp:3:1: error: 'string' does not name a type
    3 | string a[4];
      | ^~~~~~
combo.cpp:5:1: error: 'string' does not name a type
    5 | string s;
      | ^~~~~~
combo.cpp:12:1: error: 'string' does not name a type
   12 | string guess_sequence(int n){
      | ^~~~~~