# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990030 | TitanicXDzz | Combo (IOI18_combo) | C++14 | 1 ms | 344 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;
std::string guess_sequence(int N) {
std::string p = "AB";
int coins = press(p);
if(coins>=1){
string s="A";
coins=press(s);
if(coins==1){
p="A";
for(int i=2;i<N;i++){
s=p+"BB"+p+"BX"+p+"BY"+p+"X";
coins=press(s);
if(coins==i+1)
p+="B";
else if(coins==i)
p+="X";
else
p+="Y";
}
s=p+"B";
coins=press(s);
if(coins==N)
p=s;
else{
s=p+"X";
coins=press(s);
if(coins==N)
p=s;
else
p+="Y";
}
}
else{
p="B";
for(int i=2;i<N;i++){
s=p+"AA"+p+"AX"+p+"AY"+p+"X";
coins=press(s);
if(coins==i+1)
p+="A";
else if(coins==i)
p+="X";
else
p+="Y";
}
s=p+"A";
coins=press(s);
if(coins==N)
p=s;
else{
s=p+"X";
coins=press(s);
if(coins==N)
p=s;
else
p+="Y";
}
}
}
else{
string s="X";
coins=press(s);
if(coins==1){
p="X";
for(int i=2;i<N;i++){
s=p+"BB"+p+"BA"+p+"BY"+p+"A";
coins=press(s);
if(coins==i+1)
p+="B";
else if(coins==i)
p+="A";
else
p+="Y";
}
s=p+"B";
coins=press(s);
if(coins==N)
p=s;
else{
s=p+"A";
coins=press(s);
if(coins==N)
p=s;
else
p+="Y";
}
}
else{
p="Y";
for(int i=2;i<N;i++){
s=p+"AA"+p+"AX"+p+"AB"+p+"X";
coins=press(s);
if(coins==i+1)
p+="A";
else if(coins==i)
p+="X";
else
p+="B";
}
s=p+"A";
coins=press(s);
if(coins==N)
p=s;
else{
s=p+"X";
coins=press(s);
if(coins==N)
p=s;
else
p+="B";
}
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |