Submission #1006715

#TimeUsernameProblemLanguageResultExecution timeMemory
1006715devariaotaCombo (IOI18_combo)C++17
0 / 100
15 ms768 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
string guess_sequence(int N) {
    int n = N;
    string now = "", S;
    char ch[4] = {'A', 'B', 'X', 'Y'};
    int k = press("AB");
    if(k >= 1) {
      k = press("A");
      if(k == 1) now = "A";
      else now = "B";
    }
    else {
      k = press("X");
      if(k >= 1) now = "X";
      else now = "Y";
    }
    if(n == 1) return now;
    for(int i = 1; i + 1 < n; i++) {
      vector<char> p;
      for(auto j : ch) {
        if(now[0] == j) continue;
        p.pb(j); 
      }
      string hai = now + p[0] + now + p[1] + p[0] + now + p[1] + p[1] + now + p[1] + p[2];
      k = press(hai);
      if(k == i - 1) now = now + p[2];
      else if(k == i) now = now + p[0];
      else now = now + p[1];
    }
    k = press(now + 'A' + now + 'B');
    if(k == n) {
      k = press(now + 'A');
      if(k == n) S = now + 'A';
      else S = now + 'B';
    } else {
      k = press(now + 'X');
      if(k == n) S = now + 'X';
      else S = now + 'Y';
    }
    return S;


}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...