# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160289 | LKMS | Combo (IOI18_combo) | C++11 | 1 ms | 236 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 <string>
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string p="AB";
string S="";
int indice=0;
int res=press(p);
if(res>=1){
p='A';
res=press(p);
if(res==1){
///A
S+='A';
}else{
S+='B';
}
}else{
p='X';
res=press(p);
if(res==1){
S+='X';
}else{
S+='Y';
}
}
cout<<S<<'\n';
///Primera letra
for(int i=2;i<N;i++){
if(S[0]=='A'){
p=S+'B'+S+'X'+'B'+S+'X'+'X'+S+'X'+'Y';
res=press(p);
if(res==i){
S+='B';
}
if(res==(i+1)){
S+='X';
}
if(res==(i-1)){
S+='Y';
}
}
if(S[0]=='B'){
p=S+'A'+S+'X'+'A'+S+'X'+'X'+S+'X'+'Y';
res=press(p);
if(res==i){
S+='A';
}
if(res==(i+1)){
S+='X';
}
if(res==(i-1)){
S+='Y';
}
}
if(S[0]=='X'){
p=S+'A'+S+'B'+'A'+S+'B'+'B'+S+'B'+'Y';
res=press(p);
if(res==i){
S+='A';
}
if(res==(i+1)){
S+='B';
}
if(res==(i-1)){
S+='Y';
}
}
if(S[0]=='Y'){
p=S+'A'+S+'X'+'A'+S+'X'+'B'+S+'X'+'X';
res=press(p);
if(res==i){
S+='A';
}
if(res==(i+1)){
S+='X';
}
if(res==(i-1)){
S+='B';
}
}
cout<<S<<'\n';
}
if(S[0]=='A'){
p=S+'B'+S+'X';
res=press(p);
if(res==N){
p=S+'B';
res=press(p);
if(res==N){
S+='B';
}else{
S+='X';
}
}else{
S+='Y';
}
}
if(S[0]=='B'){
p=S+'A'+S+'X';
res=press(p);
if(res==N){
p=S+'A';
res=press(p);
if(res==N){
S+='A';
}else{
S+='X';
}
}else{
S+='Y';
}
}
if(S[0]=='X'){
p=S+'B'+S+'A';
res=press(p);
if(res==N){
p=S+'B';
res=press(p);
if(res==N){
S+='B';
}else{
S+='A';
}
}else{
S+='Y';
}
}
if(S[0]=='Y'){
p=S+'B'+S+'A';
res=press(p);
if(res==N){
p=S+'B';
res=press(p);
if(res==N){
S+='B';
}else{
S+='A';
}
}else{
S+='X';
}
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |