제출 #762070

#제출 시각아이디문제언어결과실행 시간메모리
762070Andrey콤보 (IOI18_combo)C++14
5 / 100
1 ms236 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;

string guess_sequence(int n) {
    string ans = "";
    string p = "";
    if(press("AB") > 0) {
        if(press("A") > 0) {
            ans = "A";
        }
        else {
            ans = "B";
        }
    }
    else {
        if(press("X")) {
            ans = "X";
        }
        else {
            ans = "Y";
        }
    }
    char buk[4] = {'A','B','X','Y'};
    vector<char> bruh(0);
    for(int i = 0; i < 4; i++) {
        if(buk[i] != ans[0]) {
            bruh.push_back(buk[i]);
        }
    }
    for(int i = 1; i < n-1; i++) {
        p = "";
        p+=ans;
        p+=bruh[0];
        p+=ans;
        p+=bruh[1];
        p+=bruh[0];
        p+=ans;
        p+=bruh[1];
        p+=bruh[1];
        p+=ans;
        p+=bruh[1];
        p+=bruh[2];
        int c = press(p);
        if(c == i) {
            ans+=bruh[2];
        }
        else if(c == i+1) {
            ans+=bruh[0];
        }
        else {
            ans+=bruh[1];
        }
    }
    if(press(ans+bruh[0]) == n) {
        ans+=bruh[0];
    }
    else if(press(ans+bruh[1]) == n) {
        ans+=bruh[1];
    }
    else {
        ans+=bruh[2];
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...