| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 980430 | janson0109 | 콤보 (IOI18_combo) | C++14 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <combo.h>
using namespace std;
string guess_sequence(int N) {
    string p = "";
    string pos;
    if(press("AB") >= 1) {
        if(press("A") == 1) {
            p += "A";
            pos = "BXY";
        } else {
            p += "B";
            pos = "AXY";
        }
    } else {
        if(press("X") == 1) {
            p += "X";
            pos = "ABY";
        } else {
            p += "Y";
            pos = "ABX";
        }
    }
    for(int i=1; i<N-1; i++) {
        string guess = p + pos[1];
        for(int j=0; j<3; j++) {
            guess += p+pos[0]+pos[j];
        }
        int l = p.size()
        int length = press(guess);
        if(length == l) {
            p += pos[2];
        } else if(length == l+1) {
            p += pos[1];
        } else if(length == l+2) {
            p += pos[0];
        }
    }
    for(int i=0; i<2; i++) {
        if(press(p+pos[i])==N) {
            return p+pos[i];
        }
    }
    return p+pos[2];
}
