Submission #419290

#TimeUsernameProblemLanguageResultExecution timeMemory
419290AntekbCombo (IOI18_combo)C++14
100 / 100
35 ms728 KiB
    #include "combo.h"
    #include<bits/stdc++.h>
    #define pb(x) push_back(x)
    using namespace std;
    string guess_sequence(int N) {
      	string p = "AB";
     	int c = press(p);
      	vector<string> V2;
      	string S = "";
      	if(c>=1){
      		int c=press("A");
      		if(c==1)V2={"B", "X", "Y"}, S="A";
      		else V2={"A", "X", "Y"}, S="B";
      	}
      	else{
      		int c=press("X");
      		if(c==1)V2={"A", "B", "Y"}, S="X";
      		else V2={"A", "B", "X"}, S="Y";
      	}
      	int i=1;
      	for(; i<N-1; ){
      		p=S+V2[0]+V2[0]+S+V2[0]+V2[1]+S+V2[0]+V2[2]+S+V2[1];
      		int c=press(p);
      		//cout<<c<<"\n";
      		c-=S.size();
      		if(c==0){
      			//cout<<"a\n";
      			S+=V2[2];
      			i++;
      		}
      		else if(c==1){
      		//cout<<"b\n";
      			S+=V2[1];
      			i++;
      		}
      		else{
      		//cout<<"b\n";
      			S+=V2[0];
      			i++;
      		}
      	}
      	if(i==N-1){
      		int c=press(S+V2[0]);
      		if(c==N)S+=V2[0];
      		else{
      			int c=press(S+V2[1]);
      			if(c==N)S+=V2[1];
      			else S+=V2[2];
      		}
      	}
      	//cout<<S<<"\n";
     	return S;
    }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...