Submission #414980

#TimeUsernameProblemLanguageResultExecution timeMemory
414980Mohammed_AtalahCombo (IOI18_combo)C++17
10 / 100
59 ms616 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;




std::string guess_sequence(int N) {
  char cs[4] = {'A', 'B', 'X', 'Y'};
  string res = "";
  for (int i = 0; i < 4; i++) {
    string s = "";
    s += cs[i];
    s += cs[i];

    if (press(s) == 1) {
      res += cs[i];
      cs[i] = cs[3];
      break;
    }
  }

  if (N == 1) {
    return res;
  }


  for (int i = 1; i < N; i++) {
    string check = res;
    check += cs[0];
    check += res;
    check += cs[1];
    string s2 = res;
    s2 += cs[0];



    if (press(check) == i) {
      res += cs[2];

    } else {
      if (press(s2) == i) {
        res += cs[1];
      } else {
        res += cs[0];
      }
    }





    // for (int e = 0; e < 3; e++) {
    //   string check = res;
    //   check += cs[e];

    //   if (press(check) == i + 1) {
    //     res += cs[e];
    //     break;
    //   }
    // }



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