# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654540 | sofija6 | Combo (IOI18_combo) | C++14 | 36 ms | 572 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 <bits/stdc++.h>
#define ll long long
#include "combo.h"
using namespace std;
string guess_sequence(int N)
{
string ans="",c="ABXY",a="";
int x=press("AB");
if (x==2)
ans+='A';
else if (x)
{
x=press("A");
if (x)
ans+='A';
else
ans+='B';
}
else
{
x=press("X");
if (x)
ans+='X';
else
ans+='Y';
}
for (int i=0;i<4;i++)
{
if (ans[0]!=c[i])
a+=c[i];
}
for (ll i=2;i<N;i++)
{
x=press(ans+a[0]+ans+a[1]+a[0]+ans+a[1]+a[1]+ans+a[1]+a[2]);
if (x==i-1)
ans+=a[2];
else if (x==i)
ans+=a[0];
else
ans+=a[1];
}
if (ans.size()==N)
return ans;
x=press(ans+a[0]);
if (x==N)
return ans+a[0];
x=press(ans+a[1]);
if (x==N)
return ans+a[1];
return ans+a[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |