제출 #1092761

#제출 시각아이디문제언어결과실행 시간메모리
1092761TrinhKhanhDung콤보 (IOI18_combo)C++14
30 / 100
32 ms1116 KiB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(x) (int)x.size()
#define ALL(v) v.begin(),v.end()
#define MASK(k) (1LL << (k))
#define BIT(x, i) (((x) >> (i)) & 1)
#define oo (ll)1e18
#define INF (ll)1e9
#define MOD (ll)(998244353)
#include "combo.h"

using namespace std;

template<class T1, class T2>
    bool maximize(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}

template<class T1, class T2>
    bool minimize(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}

template<class T1, class T2>
    void add(T1 &a, T2 b){a += b; if(a >= MOD) a -= MOD;}

template<class T1, class T2>
    void sub(T1 &a, T2 b){a -= b; if(a < 0) a += MOD;}

template<class T>
    void cps(T &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}

//int press(string p){
//    cout << p << endl;
//    int n; cin >> n;
//    return n;
//}

string guess_sequence(int N){
    const char buttons[] = {'A', 'B', 'X', 'Y'};
    string cur = "";

    int p = press("AB");
    if(p){
        if(press("A")) cur.push_back('A');
        else cur.push_back('B');
    }
    else{
        if(press("X")) cur.push_back('X');
        else cur.push_back('Y');
    }

    vector<char> buttonsLeft;
    for(int i = 0; i < 4; i++) if(cur[0] != buttons[i]){
        buttonsLeft.push_back(buttons[i]);
    }

    for(int i = 2; i <= N; i++){
        for(int j = 0; j < 2; j++){
            if(press(cur + buttonsLeft[j]) == i){
                cur.push_back(buttonsLeft[j]);
                break;
            }
        }
        if((int)cur.size() < i) cur.push_back(buttonsLeft.back());
    }

    return cur;
}

//int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
////     freopen("durian.inp","r",stdin);
////     freopen("durian.out","w",stdout);
//
//    cout << guess_sequence(5);
//
//    return 0;
//}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...