# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990037 | TitanicXDzz | Combo (IOI18_combo) | C++14 | 21 ms | 1936 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){
if(N==1)
return "A";
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{
if(N==1)
return "B";
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){
if(N==1)
return "X";
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";
if(N==1)
return "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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |