Submission #196914

#TimeUsernameProblemLanguageResultExecution timeMemory
196914Dilshod_ImomovCombo (IOI18_combo)C++17
30 / 100
71 ms496 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

char start( string &s )
{
  char c;
  if ( press("A") ) c = 'A';
  else if ( press("B") ) c = 'B';
  else if ( press("X") ) c = 'X';
  else c = 'Y';
  for ( auto i: "ABXY" ) {
    if ( i != c ) s += i;
  }
  return c;
}

string generate( string S, string s )
{
  return S + s[0] + S + s[1];
}

string guess_sequence(int N) 
{
  string S, s, p;
  vector < string > a = {"A", "B", "X", "Y"};
  S += start(s);
  for ( int i = 1; i < N; i++ ) {
    p = generate( S, s );
    if ( press(p) == i + 1 ) {
      if ( press(S + s[0]) == i + 1 ) S += s[0];
      else S += s[1];
    } 
    else S += s[2];
  }
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...