제출 #1142526

#제출 시각아이디문제언어결과실행 시간메모리
1142526fz_00콤보 (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std; 
string guess_sequence(int n){
    string p ;
    set <string> tr;
    tr.insert("A"); tr.insert("B");
    tr.insert("X"); tr.insert("Y");
    int c  = press("AB");
    if(c==1){
        c = press("A");
        if(c==1)p="A";
        else p="B";
    }
    else {
        c = press("X");
        if(c==1)p="X";
        else p="Y";
    }
    if(n==1)return p;
    string b, x, y;
    c = 0;
    for(string h: tr){
        if(h==p)continue;
        if(c==0)b = h;
        else if(c==1)x = h;
        else y = h;
        c++;
    }
    for(int i=1; i<n-1; i++){
        string t = p+b+p+x+y+p+x+x+p+x+b;
        c = press(t);
        if(c==i)p+=y;
        else if(c==i+1)p+=b;
        else p+=x; 
    }
    c = press(p+b);
    if(c==n)p+=b;
    else{
        c = press(p+x);
        if(c==n)p+=x;
        else p+=y;
    }
    return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...