제출 #239294

#제출 시각아이디문제언어결과실행 시간메모리
239294Dremix10콤보 (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define maxp 22
#define EPS (ld)(1e-18)
#define mod (int)(1e9+7)


/// x = press(string s) for query

string guess_sequence(int N) {
    int i,j;
    string s="";

    char moves[4]={'A','B','X','Y'};

    int one,alone,no,both;
    int x=press("AB");
    if(x==0){
        no=0;
        alone=1;
        x=press("X");
        if(x==0){
            one=3;
            both=2;
        }
        else{
            one=2;
            both=3;
        }
    }
    else{
        no=2;
        alone=3;
        x=press("A");
        if(x==0){
            one=1;
            both=0;
        }
        else{
            one=0;
            both=1;
        }
    }
    s+=moves[one];

    for(i=1;i<N-1;i++){
        string p=s+moves[alone];
        for(j=0;j<4;j++)
            if(j!=one)
            p+=s+moves[both]+moves[j];
        int x=press(p);
        if(x==i)
            s+=moves[no];
        else if(x==i+1)
            s+=moves[alone];
        else
            s+=moves[both];
    }

    string p=s+moves[alone]+s+moves[no];
    x=press(p);
    if(x==N-1)
        s+=moves[both];
    else{
        p=s+moves[alone];
        x=press(p);
        if(x==N-1)
            s+=moves[no];
        else
            s+=moves[alone];

    }


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