제출 #210329

#제출 시각아이디문제언어결과실행 시간메모리
210329wiwihoCombo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#include "combo.h"

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define F first
#define S second
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}
#define pii pair<int, int>
#define pll pair<ll, ll>
#define tiii tuple<int, int, int>
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) ((a) / (b) + !!((a) % (b)))

//#define TEST

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
using namespace __gnu_pbds;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream &operator<<(ostream &o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}


string guess_sequence(int N){
    string s;
    vector<char> v = {'X', 'Y', 'A', 'B'};
    if(press(string(1, v[0]) + string(1, v[1])) >= 1){
        if(press(string(1, v[0]))){
            s += v[0];
        }
        else{
            s += v[1];
            swap(v[0], v[1]);
        }
    }
    else{
        if(press(string(1, v[2]))){
            s += v[2];
            swap(v[0], v[2]);
        }
        else{
            s += v[3];
            swap(v[0], v[3]);
        }
    }

    for(int i = 1; i < N - 1; i++){
        string t = s + v[1] + s + v[2] + v[1] + s + v[2] + v[2] + s + v[2] + v[3];
//        cerr << t << "\n";
        int tmp = press(t);
        if(tmp == i) s += v[3];
        else if(tmp == i + 1) s += v[1];
        else s += v[2];
    }

    if(press(s + v[1]) == N){
        s += v[1];
    }
    else if(press(s + v[2]) == N){
        s += v[2];
    }
    else s += v[3];

    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...