This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
* With a little appreciation, in a mostly hollow tone, she says, "Delightful." As if the world has any meaning.
* TASK : IOI18_combo
* AUTHOR : Marszpace
*/
#include<bits/stdc++.h>
using namespace std;
int press(string p);
string guess_sequence(int N) {
// First
string pref="";
{
int c1 = press("AX"),c2;
if(c1>=1){
c2=press("A");
if(c2>=1){pref.push_back('A');}
else{pref.push_back('X');}
}
else{
c2=press("B");
if(c2>=1){pref.push_back('B');}
else{pref.push_back('Y');}
}
}
// 2 - N-1
string button="ABXY";
button.erase(find(button.begin(),button.end(),pref[0]));
for(int i=2;i<=N-1;i++){
int ans=press(
pref+button[2]+button[0]+
pref+button[2]+button[1]+
pref+button[2]+button[2]+
pref+button[1]);
pref.push_back(button[ans-pref.size()]);
}
// Edge Case
if(N==1){
return pref;
}
// Last
{
int c1=press(pref+button[0]);
if(c1-1==(int)pref.size()){
pref.push_back(button[0]);
}
else{
int c2=press(pref+button[1]);
if(c2-1==(int)pref.size()){
pref.push_back(button[1]);
}
else{
pref.push_back(button[2]);
}
}
}
return pref;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |