제출 #1356155

#제출 시각아이디문제언어결과실행 시간메모리
1356155Charizard2021콤보 (IOI18_combo)C++17
30 / 100
8 ms472 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
string pos = "ABXY";
string guess_sequence(int N){
    string S = "";
    for(int j =0; j < 3; j++){
        string st = "";
        st += pos[j];
        int val = press(st);
        if(val == 1){
            S += pos[j];
            break;
        }
    }
    if(S.empty()){
        S += 'Y';
    }
    for(int j = 1; j < N; j++){
        string s2 = "";
        int cnt = 0;
        for(int k = 0; k < 4; k++){
            if(S[0] != pos[k]){
                if(cnt == 2){
                    break;
                }
                s2 += S;
                s2 += pos[k];
                cnt++;
            }
        }
        if(press(s2) == (int)S.size() + 1){
            string S3 = "";
            cnt = 0;
            string stuff = "";
            for(int k = 0; k < 4; k++){
                if(S[0] != pos[k]){
                    if(cnt == 1){
                        stuff += pos[k];
                        break;
                    }
                    S3 += S;
                    S3 += pos[k];
                    cnt++;
                }
            }
            if(press(S3) == (int)S.size() + 1){
                S = S3;
            }
            else{
                S += stuff;
            }
        }
        else{
            for(int k = 3; k >= 0; k--){
                if(S[0] != pos[k]){
                    S += pos[k];
                    break;
                }
            }
        }
    }
    return S;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…