# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86941 | tjdgus4384 | Combo (IOI18_combo) | C++14 | 52 ms | 524 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<cstdio>
#include "combo.h"
#include<string>
#include<iostream>
using namespace std;
string x[4] = {"A", "B", "X", "Y"};
string guess_sequence(int n)
{
string ans, s;
int f;
if(press("AB"))
{
if(press("A")) f = 0;
else f = 1;
}
else
{
if(press("X")) f = 2;
else f = 3;
}
ans = x[f];
for(int i = 0;i < 4;i++)
{
if(i == f) continue;
s += x[i];
}
for(int i = 2;i < n;i++)
{
string p = ans + s[0] + s[0] + ans + s[0] + s[1] + ans + s[0] + s[2] + ans + s[1];
int res = press(p);
if(res == ans.length() + 2) ans += s[0];
else if(res == ans.length() + 1) ans += s[1];
else ans += s[2];
}
if(n > 1){
if(press(ans + s[0]) == n) ans += s[0];
else if(press(ans + s[1]) == n) ans += s[1];
else ans += s[2];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |