# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284296 | MKopchev | Combo (IOI18_combo) | C++14 | 43 ms | 664 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 start="";
if(press("AB"))
{
if(press("A"))start="A";
else start="B";
}
else
{
if(press("X"))start="X";
else start="Y";
}
if(N==1)return start;
string other="";
if(start[0]!='A')other.push_back('A');
if(start[0]!='B')other.push_back('B');
if(start[0]!='X')other.push_back('X');
if(start[0]!='Y')other.push_back('Y');
for(int i=2;i<N;i++)
{
//cout<<"start= "<<start<<endl;
string cur=start;
cur.push_back(other[0]);
cur=cur+start;
cur.push_back(other[1]);
cur.push_back(other[0]);
cur=cur+start;
cur.push_back(other[1]);
cur.push_back(other[1]);
cur=cur+start;
cur.push_back(other[1]);
cur.push_back(other[2]);
int val=press(cur);
if(val==start.size())start.push_back(other[2]);
else if(val==start.size()+1)start.push_back(other[0]);
else start.push_back(other[1]);
}
string cur;
cur=start;
cur.push_back(other[0]);
if(press(cur)==N)return cur;
cur=start;
cur.push_back(other[1]);
if(press(cur)==N)return cur;
cur=start;
cur.push_back(other[2]);
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |