Submission #1340740

#TimeUsernameProblemLanguageResultExecution timeMemory
1340740kaoklaxdCombo (IOI18_combo)C++20
0 / 100
0 ms348 KiB
#include "combo.h"
#include "bits/stdc++.h"
using namespace std;

string guess_sequence(int N) {
    string p = "";
    if(press("AB") >= 1){
      if(press("A") == 1) p = "A";
      else p = "B";
    }
    else{
      if(press("XY") >= 1){
        if(press("X") == 1) p = "X";
      else p = "Y";
      }
    }
    vector <char> cha = {'A','B','X','Y'};
    cha.erase(find(cha.begin(),cha.end(),p[0]));
    while(p.size() < N-2){
      int check = press(p + cha[0] + cha[0] + p + cha[0] + cha[1] + p + cha[0] + cha[2] + p + cha[1]);
      if(check == p.size()){
        p = p + cha[2];
      }
      else if(check == p.size()+1){
        p = p + cha[1];
      }
      else{
        p = p + cha[0];
      }
    }
    if(p.size() < N){
      if(press(p+cha[0]+p+cha[1]) == p.size()+1){
        if(press(p+cha[0])== p.size()+1) p+=cha[0];
        else p+=cha[1];
      }else{
        p+=cha[2];
      }
    }
    return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...