제출 #1014491

#제출 시각아이디문제언어결과실행 시간메모리
1014491nisanduu콤보 (IOI18_combo)C++14
10 / 100
50 ms1108 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// int press(string s){
    
//     if(s=="X") return 1;
//     if(s=="XB") return 2;
//     if(s == "XBA") return 3;
//     return 0;
// }
string guess_sequence(int n){
    string st = "";
    char ct = 'A';
    vector<char> cs = {'A','B','X','Y'};
    for(auto z:cs){
        char x = z;
        string tmp = "";
        tmp += x;
        if(press(tmp)==1){
            st = tmp;
            ct = x;
            break;
        }
    }
    
    string ans = st;
    vector<char> other = {'A','B','X','Y'};
    auto ite = find(other.begin(),other.end(),ct);
    other.erase(ite);
    for(ll i=1;i<n;i++){
        for(ll j=0;j<3;j++){
            string tm = ans;
            tm += other[j];
            if(press(tm)==(i+1)){
                ans = tm;
                break;
            }
        }
    }
    
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...