Submission #585720

#TimeUsernameProblemLanguageResultExecution timeMemory
585720alirezasamimi100Combo (IOI18_combo)C++17
100 / 100
35 ms592 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

string guess_sequence(int N){
    char st;
    string ans,c;
    if(press("AB")){
        if(press("A")) st='A';
        else st='B';
    }else{
        if(press("X")) st='X';
        else st='Y';
    }
    if(st!='A') c.pb('A');
    if(st!='B') c.pb('B');
    if(st!='X') c.pb('X');
    if(st!='Y') c.pb('Y');
    ans=st;
    if(N==1) return ans;
    for(int i=1; i<N-1; i++){
        int t=press(ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1]);
        if(t==i+2) ans+=c[0];
        else if(t==i+1) ans+=c[1];
        else ans+=c[2];
    }
    if(press(ans+c[0])==N) return ans+c[0];
    else if(press(ans+c[1])==N) return ans+c[1];
    else return ans+c[2];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...