Submission #1108222

#TimeUsernameProblemLanguageResultExecution timeMemory
1108222hainam2k9Combo (IOI18_combo)C++17
0 / 100
21 ms1900 KiB
#include <bits/stdc++.h>
#include <combo.h>
#define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0)
#define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define db long double
#define sz(a) ((int)(a).size())
#define pb emplace_back
#define pf emplace_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define ins emplace
using namespace std;
const int MOD = 1e9+7, MAXN = 1e5+5;
const string NAME = "";
//int n,cnt=0;
//int press(string p){
//    ++cnt;
//    if(cnt>n+2){
//        cout << "OUT OF QUERY";
//        exit(0);
//    }
//    if(sz(p)>4*n){
//        cout << "TOO BIG";
//        exit(0);
//    }
//    cout << p << endl;
//    int x;
//    cin >> x;
//    return x;
//}
string guess_sequence(int n){
    string s,x="ABXY";
    if(press("AB")){
        if(press("B")) s='B';
        else s='A';
    }else if(press("X")) s='X';
    else s="Y";
    if(n==1) return s;
    for(int i = 0; i<sz(x); ++i)
        if(x[i]==s[0]) x.erase(i,1);
    while(sz(s)+1<n){
        string query=s+x[0]+x[1]+s+x[0]+x[2]+s+x[1];
        int tmp=press(query);
        if(tmp==sz(s)+2) s+=x[0];
        else if(tmp==sz(s)+1) s+=x[1];
        else s+=x[2];
    }
    string query=s+x[0]+s+x[1];
    if(press(query)==n){
        if(press(s+x[0])==n) s+=x[0];
        else s+=x[1];
    }else s+=x[2];
    return s;
}
//int main()
//{
//    cin >> n;
//    cout << guess_sequence(n);
//}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...