Submission #1279778

#TimeUsernameProblemLanguageResultExecution timeMemory
1279778tullCombo (IOI18_combo)C++20
30 / 100
14 ms452 KiB

#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
  int p=0,r;
  char c[]={'A','B','X','Y'};
  char sk,nt='-';
  string a="";
  for(int i=0;i<4;++i){
    char e=c[i];
    //nt=c[(i==3?0:i+1)];
    r=press(a+e);
      if(r>p){
        a+=e;
        ++p;
        sk=e;
        break;
    }
  }
  while (p<N)
  {
    for(int i=0;i<4;++i){
      char e=c[i];
      if(e==sk or e==nt)continue;
      if(N-p>1)r=press(a+e+e);
      else if(N-p==1)r=press(a+e);
      char nt=e;
      if(r>p){
        a+=e;
        if(r-p==2){
          a+=e;
          ++p;
          nt='-';
        }
        ++p;
        break;
      }
    }
  }
  
  return a;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...