Submission #1146732

#TimeUsernameProblemLanguageResultExecution timeMemory
1146732kvintsekstakordCombo (IOI18_combo)C++20
30 / 100
12 ms572 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string chars = "ABXY";

string guess_sequence(int N) {
  
  string S = "";
  for(int i = 0; i < 3; i++){
    int res = press(chars.substr(i, 1));
    if(res){
      S+=chars[i]; break;
    }
  }
  if(S.empty()) S+=chars[3];
  
  for(int i = 0; i < N-1; i++){

    vector<string> opts;
    for(int j = 0; j < 4; j++){
      if(chars[j]==S[0]) continue;

      opts.push_back(S+chars[j]);
    }
    if(press(opts[0]+opts[1])==(int)S.size()){
      S=opts[2];
    }else{
      if(press(opts[0]+opts[2])==(int)S.size()){
        S=opts[1];
      }else S=opts[0];
    }
  }

  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...