# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007254 | devariaota | Combo (IOI18_combo) | C++17 | 15 ms | 756 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 <string>
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
string ans;
int val=press("AB"), find;
if(val>0)
{
int cek=press("A");
if(cek==0)
{
ans+="B";
find=1;
}
else
{
ans+="A";
find=0;
}
}
else
{
int cek=press("X");
if(cek==0)
{
ans+="Y";
find=3;
}
else
{
ans+="X";
find=2;
}
}
if(N==1)return ans;
if(find==0)
{
for(int i=2; i<N; i++)
{
string que=ans;
que=que+ans+"YY";
que=que+ans+"YX";
que=que+ans+"YB";
que=que+ans+"X";
val=press(que);
if(val==i)ans+="X";
else if(val==i-1)ans+="B";
else ans+="Y";
}
string que;
que=ans+"B";
val=press(que);
if(val==N)return que;
que=ans+"X";
val=press(que);
if(val==N)return que;
else return ans+"Y";
}
else if(find==1)
{
for(int i=2; i<N; i++)
{
string que=ans;
que=que+ans+"YY";
que=que+ans+"YX";
que=que+ans+"YA";
que=que+ans+"X";
val=press(que);
if(val==i)ans+="X";
else if(val==i-1)ans+="A";
else ans+="Y";
}
string que;
que=ans+"A";
val=press(que);
if(val==N)return que;
que=ans+"X";
val=press(que);
if(val==N)return que;
else return ans+"Y";
}
else if(find==2)
{
for(int i=2; i<N; i++)
{
string que=ans;
que=que+ans+"YY";
que=que+ans+"YB";
que=que+ans+"YA";
que=que+ans+"B";
val=press(que);
if(val==i)ans+="B";
else if(val==i-1)ans+="A";
else ans+="Y";
}
string que;
que=ans+"A";
val=press(que);
if(val==N)return que;
que=ans+"B";
val=press(que);
if(val==N)return que;
else return ans+"Y";
}
else if(find==3)
{
for(int i=2; i<N; i++)
{
string que=ans;
que=que+ans+"XX";
que=que+ans+"XB";
que=que+ans+"XA";
que=que+ans+"B";
val=press(que);
if(val==i)ans+="B";
else if(val==i-1)ans+="A";
else ans+="X";
}
string que;
que=ans+"A";
val=press(que);
if(val==N)return que;
que=ans+"B";
val=press(que);
if(val==N)return que;
else return ans+"X";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |