제출 #547228

#제출 시각아이디문제언어결과실행 시간메모리
547228urosk콤보 (IOI18_combo)C++14
97 / 100
30 ms608 KiB
#include "combo.h"
#define here cerr<<"===========================================\n"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {for(ll i = l;i<=r;i++) cerr<<a[i]<< " ";cerr<<endl;}

using namespace std;
#define maxn 8005
ll n;
string ans;
string p;
ll a[maxn];
bool b[maxn][5];
vector<char> v = {'.','A','B','X','Y'};
string conv(ll len){
    string ans = "";
    for(ll i = 1;i<=len;i++) ans.pb(v[a[i]]);
    return ans;
}
ll m = 4;
ll cnt,c;
string guess_sequence(int N) {
    n = N;
    string a = "A";
    string b = "B";
    string d = "X";
    string e = "Y";
    c = press("AB");
    if(c){
        if(press("A")) ans = "A";
        else ans = "B";
    }else{
        if(press("X")) ans = "X";
        else ans = "Y";
    }
    if(ans=="A") a = "B",b = "X",e ="Y";
    if(ans=="B") a = "A",b = "X",e ="Y";
    if(ans=="X") a = "B",b = "A",e ="Y";
    if(ans=="Y") a = "B",b = "X",e ="A";
    for(ll i = 2;i<=n;i++){
        if(i==n){
            if(press(ans+a)==n) ans+=a;
            else if(press(ans+b)==n) ans+=b;
            else ans+=e;
            break;
        }
        if(i==n-1){
            c = press(ans+a+b);
            if(c==n){
                ans+=a;
                ans+=b;
                break;
            }
            if(c==n-1){
                ans+=a;
                c = press(ans+a);
                if(c==n){
                    ans+=a;
                    break;
                }
                ans+=e;
                break;
            }
            c = press(ans+b+b);
            if(c==n){
                ans+=b;
                ans+=b;
                break;
            }
            if(c==n-1){
                ans+=b;
                c = press(ans+a);
                if(c==n){
                    ans+=a;
                    break;
                }
                ans+=e;
                break;
            }
            ans+=e;
            c = press(ans+a);
            if(c==n){
                ans+=a;
                break;
            }
            c = press(ans+b);
            if(c==n){
                ans+=b;
                break;
            }
            ans+=e;
            break;
        }

        c = press(ans+a+ans+b+b+ans+b+a+ans+b+e);
        if(c==i){
            ans+=a;
            continue;
        }
        if(c==i+1){
            ans+=b;
            continue;
        }
        ans+=e;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...