Submission #447531

#TimeUsernameProblemLanguageResultExecution timeMemory
447531MohamedAliSaidaneCombo (IOI18_combo)C++14
0 / 100
55 ms316 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;
const char but[4] = {'A','B','X','Y'};

string guess_sequence(int n)
{
  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;
  int last = fr;
  for(int i = 1; i < n; i ++)
  {
      for(int j= 0; j < 4; j ++)
      {
          if(j == fr || j == last)
            continue;
          string g = s;
          for(int k = i ; k <= n; k++ )
            g += but[j];
          int tent = press(g);
          if(tent > prog)
          {
              s = "";
              for(int k = 0; k < tent; k ++)
                s += g[k];
              i = tent;
              prog = tent;
              last = j;
              break;
          }
      }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...