Submission #1311452

#TimeUsernameProblemLanguageResultExecution timeMemory
1311452nataliaaCombo (IOI18_combo)C++20
0 / 100
8 ms636 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
  int x;
  string s;
  char c='C';
  x = press("A");
  if(x==1) c='A';
  x = press("X");
  if(x==1) c = 'X';
  x = press("Y");
  if(x==1) c = 'Y';
  if(c=='C') c= 'B';
  s+=c;
  if(N==1)return s;
  for(int i = 1; i < N-1; i++){
    string st[4] = {s, s, s, s};
    st[0]+='B';
    st[1]+="XX";
    st[2]+="XY";
    st[3]+="XB";
    x = press(st[0]+st[1]+st[2]+st[3]);
    if(x==i) s+='Y';
    else if(x==i+1) s+='B';
    else if(x==i+2) s+='X';
    else s+='A';
  }
  if(c=='A'){
    x = press(s+'B');
    if(x==N) s+='B';
    else {
        x = press(s+'X');
        if(x==N) s+='X';
        else s+='Y';
    }
  }
  if(c=='B'){
    x = press(s+'A');
    if(x==N) s+='A';
    else {
        x = press(s+'X');
        if(x==N) s+='X';
        else s+='Y';
    }
  }
  if(c=='X'){
    x = press(s+'B');
    if(x==N) s+='B';
    else {
        x = press(s+'A');
        if(x==N) s+='A';
        else s+='Y';
    }
  }
  if(c=='Y'){
    x = press(s+'B');
    if(x==N) s+='B';
    else {
        x = press(s+'X');
        if(x==N) s+='X';
        else s+='A';
    }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...