Submission #1204245

#TimeUsernameProblemLanguageResultExecution timeMemory
120424512baaterCombo (IOI18_combo)C++20
0 / 100
0 ms404 KiB
#include "combo.h"
#include <vector>

using namespace std;

string guess_sequence(int N) {
  string buttons[4] = {"A","B","X","Y"};
  vector<string> notFirst;
  string k = "";
  int kLength = 1;
  string first = "A";
  int coins = press("AB");
  if (coins == 1) {
    coins = press("A");
    if (coins == 1) first = "A";
    else first = "B";
  } else {
    coins = press("Y");
    if (coins == 1) first = "Y";
    else first = "X";
  }
  k += first;

  while(kLength+2 <= N) {
    coins = press(k+notFirst[0]+k+notFirst[1]+notFirst[0]+k+notFirst[1]+notFirst[1]+k+notFirst[1]+notFirst[2]);
    if(coins == kLength) {
      k += notFirst[2];
      kLength++;
    } else if (coins == kLength+1) {
      k += notFirst[0];
      kLength++;
    } else {
      k += notFirst[1];
      kLength++;
    }
  }
  if (N>1) {
    coins = press(k+notFirst[0]+k+notFirst[1]);
    if (coins == kLength+1) {
      coins = press(k+notFirst[0]);
      if (coins == kLength+1) {
        k += notFirst[0];
      } else {
        k += notFirst[1];
      }
    } else {
      k += notFirst[2];
    }
  }
  return k;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...