Submission #1345141

#TimeUsernameProblemLanguageResultExecution timeMemory
1345141tullCombo (IOI18_combo)C++20
10 / 100
7 ms464 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
  string ans = "",tmp,f="ABXY",pos;
  string y[]={"BXY","AXY","ABY","ABX"};
  int x;
  for(int i=0;i<4;++i){
    string h;
    h+=f[i];
    x=press(h);
    if(x==1){
      ans=h;
      pos=y[i];
      break;
    }
  }
  for(int i=1;i<n;++i){
    tmp=ans;
    tmp+=pos[0];
    tmp+=ans;
    tmp+=pos[1];
    x=press(tmp);
    if(x==i+1){
      if(press(ans+pos[0])==i+1){
        ans+=pos[0];
      }else{
        ans+=pos[1];
      }
    }else{
      ans+=pos[2];
    }
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...