Submission #1003544

#TimeUsernameProblemLanguageResultExecution timeMemory
1003544LuvidiCombo (IOI18_combo)C++17
100 / 100
23 ms2060 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

std::string guess_sequence(int N) {
  string ans="";
  if(press("AB")){
    if(press("A"))ans+='A';
    else ans+='B';
  }else{
    if(press("X"))ans+='X';
    else ans+='Y';
  }
  string x="";
  for(char c:{'A','B','X','Y'}){
    if(c!=ans[0])x+=c;
  }
  if(N==1)return ans;
  for(int i=0;i<N-2;i++){
    string s=ans+x[0]+ans+x[1]+x[0]+ans+x[1]+x[1]+ans+x[1]+x[2];
    int co=press(s)-ans.length();
    if(!co)ans+=x[2];
    else if(co==1)ans+=x[0];
    else ans+=x[1];
  }
  if(press(ans+x[0])-ans.length())ans+=x[0];
  else if(press(ans+x[1])-ans.length())ans+=x[1];
  else ans+=x[2];
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...