# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
633504 | anjamilicevic | Combo (IOI18_combo) | C++14 | 40 ms | 540 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>
#define IOS {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
using namespace std;
vector<char> v={'A', 'B', 'X', 'Y'}, w;
string guess_sequence(int n)
{
string s="";
char x;
string p="AB";
if(press(p))
{
x='B';
if(press("A"))x='A';
}
else
{
x='Y';
if(press("X"))x='X';
}
s+=x;
for(auto u:v)
{
if(u!=x)w.pb(u);
}
while(s.size() < n-1)
{
string q=s+w[0]+s+w[1]+w[0]+s+w[1]+w[1]+s+w[1]+w[2];
int cnt=press(q);
int vel=s.size();
if(cnt == vel+1)s+=w[0];
else if(cnt == vel+2)s+=w[1];
else if(cnt == vel)s+=w[2];
}
if(n>1)
{
char c=w[2];
for(int i=0; i<2; i++)
{
string k=s+w[i];
if(press(k) == n)
{
c=w[i];
break;
}
}
s+=c;
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |