Submission #1290000

#TimeUsernameProblemLanguageResultExecution timeMemory
1290000oruc콤보 (IOI18_combo)C++20
30 / 100
11 ms448 KiB
#include <bits/stdc++.h>

using namespace std;
#include "combo.h"


string guess_sequence(int N){
    string ans = "";
    char ilk = ' ';
    int ab = press("AB");
    int ax = press("AX");
    if(N > 1){
        if(ab == 0){
            if(ax == 0){
                ans = "Y";
            }
            else if(ax == 1){
                ans = "X";
            }
            else{
                ans = "A";
            }
        }
        else if(ab == 1){
            if(ax == 0){
                ans = "B";
            }
            else if(ax == 1){
                ans = "A";
            }
            else{
                ans = "A";
            }
        }
        else{
            ans = "A";
        }
        ilk = ans[0];
    }

    for(int i = 2; i <= (N > 1 ? N : 2); i++){
        int c = 0;
        for(char j: {'A','B','X','Y'}){
            if(j == ilk) continue;
            if(c == 2 && ilk != ' '){
                ans += j;
                break;
            }
            int ok = press(ans+j);
            if(ok == ans.size()+1){
                ans += j;
                break;
            }
            c++;
        }
    }
    //cout << ans << endl;
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...