# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
716603 | TahirAliyev | Combo (IOI18_combo) | C++17 | 32 ms | 568 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 = "";
if(press("AB")){
if(press("A")){
ans += 'A';
}
else{
ans += 'B';
}
}
else{
if(press("X")){
ans += 'X';
}
else{
ans += 'Y';
}
}
if(N == 1) return ans;
vector<char> v = {'A', 'B', 'X', 'Y'};
v.erase(find(v.begin(), v.end(), ans[0]));
for (int i = 0; i < N - 2; i++)
{
string help = "";
help += ans;
help += v[0];
for (int j = 0; j < 3; j++)
{
help += ans;
help += v[1];
help += v[j];
}
int coins = press(help);
if(coins == ans.size() + 1){
ans += v[0];
}
else if(coins == ans.size() + 2){
ans += v[1];
}
else{
ans += v[2];
}
}
if(press(ans + v[0]) == N){
ans += v[0];
}else if(press(ans + v[1]) == N){
ans += v[1];
}
else{
ans += v[2];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |