# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1161939 | tsengang | 콤보 (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
const int mod = 998244353;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
string guess_sequence(int n){
string s = "";
vector<char> chr = {'A', 'B', 'X', 'Y'};
if(press("AB") > 0){
if(press("A") > 0){
s += 'A';
chr.erase(find(all(chr), 'A'));
}
else{
s += 'B';
chr.erase(find(all(chr), 'B'));
}
}
else{
if(press("X") > 0){
s += 'X';
chr.erase(find(all(chr), 'X'));
}
else{
s += 'Y';
chr.erase(find(all(chr), 'Y'));
}
}
for(int i = 1;i < n-1; i++){
string t= s + ch[0] + ch[0] + s + ch[0] + ch[1] + s + ch[0] + ch[2] + s + ch[1];
int x=press(t);
if(x==i+2){
s+=ch[0];
}
else if(x==i+1){
s+=ch[1];
}
else{
s+=ch[2];
}
}
if(press(s + chr[0]) == n){
s += chr[0];
}
else if(press(s + chr[1]) == n){
s += chr[1];
}
else{
s += chr[2];
}
ertunt s;
}