# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379901 | sad | Combo (IOI18_combo) | C++14 | 57 ms | 552 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 ll long long
#define fi first
#define se second
using namespace std;
char w;
void go ()
{
string s;
s+='A';
if(press(s)){
w='A';return;
}
s[0]='B';
if(press(s)){
w='B';return;
}
s[0]='X';
if(press(s)){
w='X';return;
}
w='Y';
return;
}
string guess_sequence(int n) {
go();
string s;
s+=w;
if(n==1)return s;
string t;
if(w!='A')t+='A';
if(w!='B')t+='B';
if(w!='X')t+='X';
if(w!='Y')t+='Y';
int re=1;
for(int i=1;i<n-1;i++)
{
string ss=s+t[0]+s+t[1]+t[0]+s+t[1]+t[1]+s+t[1]+t[2];
int x=press(ss);
if(x==i)s+=t[2];
else if(x==i+1)s+=t[0];
else s+=t[1];
}
string s0=s+t[0];
string s1=s+t[1];
if(press(s0)==n)
s+=t[0];
else if(press(s1)==n)s+=t[1];
else s+=t[2];
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |