| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1364561 | paskalisapo | 콤보 (IOI18_combo) | C++20 | 0 ms | 0 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
pressans = press(ask);
if(pressans == pos){
curpref += not_first[0];
}
else if(pressans == 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;
}
