Submission #447538

#TimeUsernameProblemLanguageResultExecution timeMemory
447538MohamedAliSaidaneCombo (IOI18_combo)C++14
5 / 100
1 ms276 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define pb push_back
#define popb pop_back
#define ff first
#define ss second
const int MOD = 1e9 + 7;
const ll INF = 1e18;


string guess_sequence(int n)
{
    char but[4] = {'A','B','X','Y'};
  string p = "";
  string s = "";
  int fr = -1;
  for(int i = 0; i < 4; i ++)
  {
      string g = p + but[i];
      int rep = press(g);
      if(rep == 1)
      {
          fr = i;
          s = g;
          break;
      }
  }
  int prog = 1;
  but[3] = but[fr];
  but[fr] = 'Y';
  for(int i = 1; i < n - 1; i ++)
  {
     char b = but[0];
     char x= but[1];
     char y = but[2];
     string g = s + b;
     g += (s+ x + x);
     g += (s+ x + b);
     g += (s+ x + y);
     int tent = press(g);
     if(tent == prog +1)
     {
         prog ++;
         s += b;
     }
     else if(tent == prog + 2)
     {
         prog ++;
         s += x;
     }
     else
     {
         prog ++;
         s += y;
     }
  }
  for(int j = 0; j < 3; j ++)
  {
      string g = s + but[j];
      int tent = press(g);
      if(tent == n)
      {
          s += but[j];
          break;
      }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...