# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160295 | LKMS | Combo (IOI18_combo) | C++11 | 2 ms | 244 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';
}
}
///Primera letra
for(int i=2;i<N;i++){
if(S[0]=='A'){
p=S+'B'+S+"XB"+S+"XX"+S+"XY";
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+"XA"+S+"XX"+S+"XY";
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+"BA"+S+"BB"+S+"BY";
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+"XA"+S+"XB"+S+"XX";
res=press(p);
if(res==i){
S+='A';
}
if(res==(i+1)){
S+='X';
}
if(res==(i-1)){
S+='B';
}
}
}
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... |