# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1016462 | vjudge1 | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string s = "";
string chars;
// find first button
int f = press("AB");
if(f==1){
int ff = press("A");
if(ff==1) {
chars = "BXY";
s = "A";
}
else{
chars = "AXY";
s = "B";
}
}
else{
int ff = press("X");
if(ff==1){
chars = "ABY";
s = "X";
}
else{
chars = "ABX";
s = "Y";
}
}
// find 2nd to 2nd last button
for (int i=2; i<N; i++){
string qry = s+chars[1] + s+chars[2]+chars[0] + s+chars[2]+chars[1] + s+chars[2]+chars[2];
int coins = press(qry);
if(coins==i-1) s += chars[0];
else if(coins==i) s += chars[1];
else s += chars[2];
}
// find last button
int l = qry(s+chars[0]);
if(l==N) s += chars[0];
else{
int ll = qry(s+chars[1]);
if(ll==N) s += chars[1];
else s += chars[2];
}
return s;
}