# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
215942 | tushar_2658 | Combo (IOI18_combo) | C++14 | 1 ms | 200 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;
string guess_sequence(int N) {
string ans;
ans ="A";
int tot = press(ans);
if(tot == 0){
ans = "B";
tot = press(ans);
}
else if(tot == 0){
ans = "X";
tot = press(ans);
}
else if(tot == 0){
ans = "Y";
}
if(N == 1){
string ret;
ret += ans[0];
return ret;
}
string ss = "ABXY";
char c;
for(int j = 0; j < 3; j++){
if(ss[j] == ans[0]){
ss.erase(j, 1);
}
}
c = ss.back();
ss.pop_back();
for(int i = 1; i < N; ){
string dummy;
dummy += ss[0];
dummy += c;
int x = press(ans + dummy);
if(x == tot + 2){
ans += dummy;
tot += 2;
i += 2;
continue;
}else if(x == tot + 1){
ans += ss[0];
i++;
tot++;
continue;
}
dummy[0] = ss[1];
x = press(ans + dummy);
if(x == tot + 2){
ans += dummy;
tot += 2;
i += 2;
continue;
}else if(x == tot + 1){
ans += ss[0];
i++;
tot++;
continue;
}
dummy = c;
dummy += c;
if(press(ans + dummy) == tot + 2){
ans += dummy;
tot += 2;
i += 2;
}else {
ans += c;
tot++;
i++;
}
}
if(ans.size() != N){
if(press(ans + ss[0]) == tot + 1){
ans += ss[0];
}else {
ans += ss[1];
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |