제출 #1356516

#제출 시각아이디문제언어결과실행 시간메모리
1356516dreamofsecretuniverse콤보 (IOI18_combo)C++20
0 / 100
0 ms344 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define rep_(i, a, b) for(ll i = a; i > b; i--)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
constexpr ll mod = 1e9+7, inf = LLONG_MAX;
string guess_sequence(int n) {
  string s(n, '_');
  {
    ll c = press("AB");
    if(c){
      c = press("A");
      s[0] = c?'A':'B';
    }else{
      c = press("X");
      s[0] = c?'X':'Y';
    }
  }
  string u = "BXY";
  if(s[0]=='B') u = "AXY";
  else if(s[0]=='X') u = "ABY";
  else if(s[0]=='Y') u = "ABX";
  string last(1, s[0]);
  for(ll i = 1; i < n-1; ++i){
    string cur = (last+to_string(u[0])+to_string(u[0]))
                +(last+to_string(u[0])+to_string(u[1]))
                +(last+to_string(u[0])+to_string(u[2]))
                +(last+to_string(u[1]));
    ll cnt = press(cur);
    ll sz = last.size();
    if(cnt==sz+2) last += to_string(u[0]);
    else if(cnt==sz+1) last += to_string(u[1]);
    else last += to_string(u[2]);
    s[i] = last.back();
  }
  {
    ll c = press(to_string(u[0])+to_string(u[1]));
    if(c){
      c = press(to_string(u[0]));
      s[n-1] = c?u[0]:u[1];
    }else{
      s[n-1] = u[2];
    }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...