제출 #1364557

#제출 시각아이디문제언어결과실행 시간메모리
1364557paskalisapoCombo (IOI18_combo)C++20
5 / 100
0 ms412 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N){
    char first;
    if(press("AB") > 0) {
        if(press("A") > 0) {
            first = 'A';
        }
        else {
            first = 'B';
        }
    }
    else {
        if(press("X") > 0){
            first = 'X';
        }
        else{
            first = 'Y';
        }
    }

    string curpref ;
    curpref += first;
    vector<char> not_first;

    if(first != 'A'){
        not_first.push_back('A');
    }
    if(first != 'B'){
        not_first.push_back('B');
    }
    if(first != 'X'){
        not_first.push_back('X');
    }
    if(first != 'Y'){
        not_first.push_back('Y');
    }

    for(int pos = 2; pos <= N - 1; pos++){
        
        //return pos if it is 0
        string ask = curpref;
        ask += not_first[0];

        //return pos + 1 if it is 1
        ask += curpref;
        ask += not_first[1];
        ask += not_first[2];
        ask += curpref;
        ask += not_first[1];
        ask += not_first[1];
        ask += curpref;
        ask += not_first[1];
        ask += not_first[0];

        //return pos - 1 if it is 2

        if(press(ask) == pos){
            curpref += not_first[0];
        }
        else if(press(ask) == pos + 1){
            curpref += not_first[1];
        }
        else {
            curpref += not_first[2];
        }
    }

    if(press(curpref + not_first[0]) == N) {
        curpref += not_first[0];
    }
    else if(press(curpref + not_first[1]) == N) {
        curpref += not_first[1];
    }
    else {
        curpref += not_first[2];
    }

    return curpref;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…