# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
866695 | vjudge1 | 콤보 (IOI18_combo) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<string>
#include<vector>
#include "combo.h"
using namespace std;
// int press(string s){
// return 1;
// }
string guess_sequence(int n){
vector<char>buttons = {'A','B','X','Y'};
char starting_char = '0';
if(press("AB")){
if(press("A"))
starting_char = 'A';
else
starting_char = 'B';
}
else{
if(press("X"))
starting_char = 'X';
else
starting_char = 'Y';
}
string ans{starting_char};
buttons.erase(find(buttons.begin(), buttons.end(), starting_char));
// s + B + s + XY + s + XB + s + XX -> if starting_char == A
for(int i = 2; i < n; ++i){
int current_coins = press(ans + string{buttons[0]} + ans + string{buttons[1],buttons[2]} + ans
+ string{buttons[1], buttons[1]} + ans + string{buttons[1], buttons[1]});
if(current_coins == i)
ans.push_back(buttons[2]);
else if(current_coins == i + 1)
ans.push_back(buttons[0]);
else if(current_coins == i + 2)
ans.push_back(buttons[1]);
}
if(press(ans + string{buttons[0], buttons[1]}) == n){
if(press(ans + string{buttons[0]}) == n)
ans.push_back(buttons[0]);
else
ans.push_back(buttons[1]);
}
else{
ans.push_back(buttons[2]);
}
return ans;
}