Submission #1325919

#TimeUsernameProblemLanguageResultExecution timeMemory
1325919x_aCombo (IOI18_combo)C++20
0 / 100
0 ms400 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N) {
  string p = "", s = "";
  int last = 0, x;
  char t = 'x';
  vector<char> A = {'A', 'B', 'X', 'Y'}, c;
  for (int i = 0; i < 1; ++i) {
    
    x = press("AB");
    if(x >= 1){
      if(press("A")) s = "A";
      else s = "B";
    }
    else{
      if(press("X")) s = "X";
      else s = "Y";
    }
    if(N == 1) break;
    for(char x : A) if(x != s[0]) c.push_back(x);
    int last = 1;

    for(int i = 1; i < N - 1; i ++){
      x = press(s + c[0] + s + c[1] + c[0] + s + c[1] + c[1] + s + c[1] + c[2]);
      if(x == last + 1){
        s += c[0];
      }
      else if(x == last + 2){
        s += c[1];
      }
      else{
        s += c[2];
      }
      last ++;
    }
    int cnt = 0;
    for(char x : c){
      if(cnt == 2){
        s += x;
        break;
      }
      if(press(s + x) == last + 1) s += x;
      cnt ++;
    }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...