# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
401874 | hibye1217 | 콤보 (IOI18_combo) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
string guess_sequence(int N){
string ans = "";
int res = press("AB");
if (res >= 1){
res = press("A");
if (res == 1){ ans += "A"; }
else{ ans += "B"; }
}
else{
res = press("X");
if (res == 1){ ans += "X"; }
else{ ans += "Y"; }
}
char c1, c2, c3;
if (ans[0] == 'A'){ c1 = 'B'; c2 = 'X'; c3 = 'Y'; }
if (ans[0] == 'B'){ c1 = 'A'; c2 = 'X'; c3 = 'Y'; }
if (ans[0] == 'X'){ c1 = 'A'; c2 = 'B'; c3 = 'Y'; }
if (ans[0] == 'Y'){ c1 = 'A'; c2 = 'B'; c3 = 'X'; }
for (int i = 2; i < N; i++){
res = press(ans+c1+c1 + ans+c1+c2 + ans+c1+c3 + ans+c2);
if (res > i){ ans += c1; }
if (res == i){ ans += c2; }
if (res < i){ ans += c3; }
}
res = press(ans+c1);
if (res == N){ return ans+c1; }
res = press(ans+c2);
if (res == N){ return ans+c2; }
else{ return ans+c3; }
}