Submission #1301823

#TimeUsernameProblemLanguageResultExecution timeMemory
1301823hectormedranoCombo (IOI18_combo)C++20
100 / 100
8 ms544 KiB
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include "combo.h"
using namespace std;
typedef long long ll;

string guess_sequence(int N) {
  string S, p;
  S = "";
  char F;
  if(press("AB")){
    if(press("B")){S += "B"; F = 'B';}
    else{S += "A"; F = 'A';}
  } else {
    if(press("X")){S += "X"; F = 'X';}
    else{S += "Y"; F = 'Y';}
  }
  if(N==1){return S;}
    string c = "";
    if(F != 'A'){
        c += 'A';
    }
    if(F != 'B'){
        c += 'B';
    }
    if(F != 'X'){
        c += 'X';
    }
    if(F != 'Y'){
        c += 'Y';
    }
    for(ll i=0;i<N-2;i++){
        p = S + c[0] + S + c[1] + c[0] + S + c[1] + c[1] + S + c[1] + c[2];
        //cout<<p<<endl;
        //cout<<"meow"<<endl;
        ll k = press(p);
        if(k == S.size()){
            S += c[2];
        }
        if(k == S.size() + 1){
            S += c[0];
        }
        if(k == S.size() + 2){
            S += c[1];
        }
    }
    p = S + c[0] + S + c[1];
    ll k = press(p);
    if(k == N){
        if(press(S + c[0]) == N){S += c[0];}
        else{S += c[1];}
    } else {
        S += c[2];
    }
  //cout<<S<<endl;
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...