Submission #956238

#TimeUsernameProblemLanguageResultExecution timeMemory
956238FaisselCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
#include "combo.h" 
#define ll long long
#define endl '\n'
string guess_sequence(int n){
    string y = "ABXY";
    string ans = "";
    if(press("AB")){
      if(press("A")){
        ans += 'A';
        y.erase(y.begin());
      }else{
        ans += 'B';
        y.erase(y.begin() + 1);
      }
    }else{
      if(press("X")){
        ans += 'X';
        y.erase(y.begin() + 2);
      }else{
        ans += 'Y';
        y.erase(y.begin() + 3);
      }
    }
    for(int i=2;i<n;i++){
      string u = ans + y[0];
      string j = ans + y[1] + y[0] + ans + y[1] + y[1] + ans + y[1] + y[2];
      int val = press(u+j);
      if(val == i){
        ans += y[0];
      }else if(val == i+1){
        ans += y[1];
      }else{
        ans += y[2];
      }
    }
    if(press(ans + y[0]) == n){
      ans += y[0];
    }else{
      if(press(ans + y[1]) == n){
        ans += y[1];
      }else{
        ans += y[2];
      }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...