# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
75139 | doowey | Combo (IOI18_combo) | C++14 | 57 ms | 612 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
char ok[] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int N) {
string pref;
if(press("AB") > 0){
if(press("A"))
pref += "A";
else
pref += "B";
}
else{
if(press("X"))
pref += "X";
else
pref += "Y";
}
vector<char> use;
for(int i = 0;i < 4;i ++ ){
if(pref[0] != ok[i])
use.push_back(ok[i]);
}
string as;
int sum;
for(int i = 0;i < N-2; i ++ ){
as = pref + use[0] + pref + use[1] + use[0] + pref + use[1] + use[1] + pref + use[1] + use[2];
sum = press(as);
if(sum == pref.size() + 1)
pref += use[0];
else if(sum == pref.size() + 2)
pref += use[1];
else
pref += use[2];
}
if(N == 1)
return pref;
if(press(pref + use[0]) == N)
return pref + use[0];
else if(press(pref + use[1]) == N)
return pref + use[1];
else
return pref + use[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |