# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339598 | ogibogi2004 | Combo (IOI18_combo) | C++14 | 44 ms | 516 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 p = "";
for (int i = 0; i < 4 * N; ++i) {
p += 'A';
}
int coins = press(p);
string S = "";
for (int i = 0; i < N; ++i) {
S += 'A';
}
return S;*/
string p="";
string s="";
vector<char>v;
p="AB";
int xd=press(p);
if(xd==0)
{
xd=press("X");
if(xd==0)s+="Y";
else s+="X";
}
else
{
xd=press("A");
if(xd==0)s+="B";
else s+="A";
}
if(s[0]!='A')v.push_back('A');
if(s[0]!='X')v.push_back('X');
if(s[0]!='Y')v.push_back('Y');
if(s[0]!='B')v.push_back('B');
if(N==1)
{
return s;
}
for(int i=1;i+1<N;i++)
{
p="";
p+=s;p+=v[0];
p+=s;p+=v[1];p+=v[0];
p+=s;p+=v[1];p+=v[1];
p+=s;p+=v[1];p+=v[2];
xd=press(p);
if(xd==s.size())
{
s+=v[2];
}
else if(xd==s.size()+1)
{
s+=v[0];
}
else
{
s+=v[1];
}
}
p=s;
p+=v[0];
xd=press(p);
if(xd==N)return p;
p=s;
p+=v[1];
xd=press(p);
if(xd==N)return p;
p=s;
p+=v[2];
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |