제출 #198928

#제출 시각아이디문제언어결과실행 시간메모리
198928andrew콤보 (IOI18_combo)C++17
100 / 100
51 ms616 KiB
#include <bits/stdc++.h>
#include "combo.h"
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 1e6;
const ll mod = 1e9 + 7;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T> void vout(T s){cout << s << endl;exit(0);}

string guess_sequence(int N){
    string ans;
    string t = "AB";
    string s1 = "ABXY";
    ll val = press(t);
    if(val >= 1){
        t = "A";
        if(val == 2 && N == 2)return "AB";
        if(press(t) == 1){
            ans += "A";
            s1.erase(s1.find('A'), 1);
        }else{
            ans += "B";
            s1.erase(s1.find('B'), 1);
        }
    }else{
        t = "X";
        if(press(t) == 1){
            ans += "X";
            s1.erase(s1.find('X'), 1);
        }else{
            ans += "Y";
            s1.erase(s1.find('Y'), 1);
        }
    }


    for(int i = 2; i < N; i++){
        string mb;
        mb = ans + s1[0] + ans + s1[1] + s1[0] + ans + s1[1] + s1[1] + ans + s1[1] + s1[2];
        ll val = press(mb);
        if(val == i)ans += s1[0];
        else if(val == i + 1)ans += s1[1];
        else ans += s1[2];

    }

    if(N == 1)return ans;

    random_shuffle(s1.begin(), s1.end());
    if(press(ans + s1[0]) == N)ans += s1[0];
    else if(press(ans + s1[1]) == N)ans += s1[1];
    else ans += s1[2];
    return ans;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...