# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
543357 | Blobo2_Blobo2 | 콤보 (IOI18_combo) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
//#define int long long
//#define endl "\n"
#define all(v) v.begin(),v.end()
#define gen(arr,n,nxt) generate(arr,arr+n,nxt)
#define Blobo2 ios_base::sync_with_stdio(false);cin.tie(0);
char le[]={'A','B','X','Y'};
string guess_sequence(int n){
string t = "AB";
int x = press(t);
if(x == 2) t = "A";
else if(x){
t = "B";
x=press(t);
if(!x)
t = "A";
}
else{
t = "X";
x = press(t);
if(!x)
t = "Y";
}
int idx = 0;
for(int i=0;i<4;i++){
if(le[i] == t[0]){
idx = i;
break;
}
}
for(int i=1;i<n;i++){
string test;
test += t;
test += le[(idx+1)%4];
test += t;
test += le[(idx+2)%4];
test += le[(idx+1)%4];
test += t;
test += le[(idx+2)%4];
test += le[(idx+2)%4];
test += t;
test += le[(idx+2)%4];
test += le[(idx+3)%4];
x = press(test);
if(x == (int)t.size())
t += le[(idx+3)%4];
else if(x == (int)t.size()+1)
t += le[(idx+1)%4];
else
t += le[(idx+2)%4];
//cout<<t<<endl;
}
return t;
}