Submission #104535

#TimeUsernameProblemLanguageResultExecution timeMemory
104535mohammadCombo (IOI18_combo)C++14
100 / 100
41 ms692 KiB
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/

#include "iostream"
#include "vector"
#include "map"
#include "math.h"
#include "string"
#include "algorithm"
#include "set"
#include <iterator>
#include <string.h>
#include <queue>
#include <list>
#include "combo.h"

using namespace std;

typedef long long ll ;
const ll M = 1e9 + 7 ;
const ll oo = 1e13 ;


int head , len=1;

void start();
void end(int N);
string c="ABXY",S,id;
vector<string>h[4]; 
string generate_press(){
    return S+id[0]+S+id[1]+id[0]+
    S+id[1]+id[1]+S+id[1]+id[2]; 
}
string guess_sequence(int N){
    start();
    while(len<N-1){
        int opt = press(generate_press()) - len;
        S+=id[(opt+2)%3];++len;
    }
    if (len==N-1) end(N);
    return S;
}
void start(){
    S=id="";
    if (press("AB")){
        if (press("A")) S+=c[head=0];
        else S+=c[head=1];
    }
    else{
        if (press("X")) S+=c[head=2];
        else S+=c[head=3];
    }
    for (int i=0;i<4;++i)
        if (i!=head) id+=c[i];
}
void end(int N){
    if (press((S+id[0]+S+id[1]))==N){
        if (press((S+id[0]))==N) S+=id[0];
        else S+=id[1];
    }
    else S+=id[2];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...