Submission #1035094

#TimeUsernameProblemLanguageResultExecution timeMemory
1035094huutuanCombo (IOI18_combo)C++14
5 / 100
1 ms596 KiB
#include "combo.h"

#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N) {
   char a='A', b='B', x='X', y='Y';
   string s;
   if (press("AB")){
      if (press("A"));
      else swap(b, a);
   }else{
      if (press("X")) swap(x, a);
      else swap(y, a);
   }
   s.push_back(a);
   while ((int)s.size()+2<=N){
      string ask=s+b+s+x+b+s+x+x+s+x+y;
      int tmp=press(ask);
      if (tmp==(int)s.size()+1) s.push_back(b);
      else if (tmp==(int)s.size()+2) s.push_back(x);
      else s.push_back(y);
   }
   if (press(s+b)==N) s.push_back(b);
   else if (press(s+x)==N) s.push_back(x);
   else s.push_back(y);
   return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...