# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006750 | devariaota | Combo (IOI18_combo) | C++17 | 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.
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string S = "";
char a;
string p = "AB";
int coins = press(p);
if(coins){
p = "A";
coins = press(p);
if(coins) a = 'A';
else a = 'B';
}
else{
p = "X";
coins = press(p);
if(coins) a = 'X';
else a = 'Y';
}
S += a;
vector <char> v;
if(a != 'A') v += 'A';
if(a != 'B') v += 'B';
if(a != 'X') v += 'X';
if(a != 'Y') v += 'Y';
for(int i = 0; i < N-2; i++){
int t = 0;
p = "";
for(int j = 0; j < 3; j++){
if(j == 0){
for(auto y : v) p += S + v[j] + y;
}
if(j == 1) p += S + v[j];
}
coins = press(p);
if(coins == 2) S += v[0];
else if(coins == 1) S += v[1];
else S += v[2];
}
coins = press(p);
p = S + v[0] + S + v[1];
if(coins == N){
p = S + v[0]
coins = press(p);
if(coins == N) S += v[0];
else S += v[1];
}
else S += v[2];
return S;
}