Submission #339227

#TimeUsernameProblemLanguageResultExecution timeMemory
339227KerimCombo (IOI18_combo)C++17
5 / 100
1 ms272 KiB
#include "combo.h"
#include "bits/stdc++.h"
using namespace std;
string tmp="ABXY";
string guess_sequence(int N) {
	string ans,avl;
  if(press("AB")){
    if(press("A"))
      ans = "A";
    else
      ans = "B";
  }
  else{
    if(press("X"))
      ans = "X";
    else
      ans = "Y";
  }
	for(int i=0;i<4;i++)
		if(ans[0]!=tmp[i])
			avl+=tmp[i];
	tmp=avl;
	for(int i=2;i<N;i++){
		int val=press(ans+tmp[0]+ans+tmp[1]+tmp[0]+ans+tmp[1]+tmp[1]+ans+tmp[1]+tmp[2]);
		if(val==i)ans+=tmp[0];	
		else if(val>i)ans+=tmp[1];
		else ans+=tmp[2];
	}
	if(press(ans+tmp[0])==N)return ans+tmp[0];
	if(press(ans+tmp[1])==N)return ans+tmp[1];
	return ans+tmp[2];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...