제출 #1196008

#제출 시각아이디문제언어결과실행 시간메모리
1196008al95ireyiz콤보 (IOI18_combo)C++20
97 / 100
22 ms11348 KiB
//*** Bismillah ***//
#pragma GCC optimize("O3")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
#if !defined(ONLINE_JUDGE) and !defined(EVAL)
#include "template/debug.h"
#else
#define d(x...)
#endif
#define fr first
#define sc second
#define in insert
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vvll vector<vll>
#define vpll vector<pll>
#define len(x)(ll)x.size()
#define all(x)x.begin(),x.end()
const ll INF = 1e9;
const ll INFL = 1e18;
const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll maxn = 2e5+5;
ll n,m,k=0;
#include "combo.h"
map<string, ll>mp;
ll get(string s){
    if(mp.count(s)) return mp[s];
    return mp[s] = press(s);
}
string guess_sequence(int N){ n = N;
    string s;
    array<string, 3>ch;
    if(get("AB")){
        if(get("A")) s = "A", ch = {"B", "X", "Y"};
        else s = "B", ch = {"A", "X", "Y"};
    }
    else{
        if(get("X")) s = "X", ch = {"A", "B", "Y"};
        else s = "Y", ch = {"A", "B", "X"};
    }
    // XABY
    for(ll i = 2; i < n; i ++){
        string tmp = s + ch[0] +          // ya len(s) + 1
                     s + ch[1] + ch[0] +  // ya len(s) + 2
                     s + ch[1] + ch[1] +
                     s + ch[1] + ch[2];
                                          // ya da len(s) olacaq
        if(get(tmp) == len(s) + 1) s = s + ch[0];
        else if(get(tmp) == len(s) + 2) s = s + ch[1];
        else if(get(tmp) == len(s)) s = s + ch[2];
    }
    if(len(s) == n) return s;
    if(get(s + ch[0]) == n) return s + ch[0];
    if(get(s + ch[1]) == n) return s + ch[1];
    if(get(s + ch[2]) == n) return s + ch[2];
    return s;
}
// void _(ll tt){
    
// }
// signed main(){
//     ll tm=clock();
//     cin.tie(0)->sync_with_stdio(0);
//     ll t=1;
//     cin>>t;
//     for(ll tt=1;tt<=t;tt++){
//             _(tt);
//     }
//     cerr<<"\n\033[1;31mTime: \033[1;30m" \
//         <<(double)(clock()-tm)/1000000<<"\033[1;32m seconds\n";
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...