# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732228 | bane | Combo (IOI18_combo) | C++17 | 39 ms | 688 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.
#include<bits/stdc++.h>
using namespace std;
int press(std::string p);
string guess_sequence(int N){
vector<string>frst = {"A", "B", "X", "Y"};
string ans = "";
if (press("AB")){
if (press("A")){
ans += "A";
frst.erase(frst.begin());
}else{
ans += "B";
frst.erase(frst.begin()+1);
}
}else{
if (press("X")){
ans += "X";
frst.erase(frst.begin()+2);
}else{
ans += "Y";
frst.erase(frst.begin() + 3);
}
}
for (int i = 0 ; i < N - 2; i++){
string ask = ans + frst[0] + frst[1] + ans + frst[0] + frst[0] + ans + frst[0] + frst[2] + ans + frst[1];
int res = press(ask) - (int)ans.size();
if (res == 2){
ans+=frst[0];
}else if (res == 1){
ans += frst[1];
}else{
ans += frst[2];
}
}
if (ans.size() != N)for (int j = 0 ; j < 2; j++){
if (press(ans + frst[j]) > (int)ans.size()){
ans += frst[j];
break;
}
}
if ((int)ans.size() != N)ans+=frst[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |