제출 #132266

#제출 시각아이디문제언어결과실행 시간메모리
132266amiratou콤보 (IOI18_combo)C++14
5 / 100
2 ms256 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
vector<char> tab{'A','B','X','Y'};
string guess_sequence(int N) {
  string p = "AB";
  string ph="";
  if(press(p)>=1){
    p="A";
    if(press(p)==1)ph="A";
    else ph="B";
  }
  else{
    p="X";
    if(press(p)==1)ph="X";
    else ph="Y";
  }
  for (int i = 0; i < 4; ++i)
    if(tab[i]==ph[0]){tab.erase(tab.begin()+i);break;}
  for (int i = 1; i < N-1; ++i)
  {
    p=ph+tab[0];
    for(auto car:tab)
      p+=ph+tab[1]+car;
    int coins=press(p);
    //cerr<<p<<" "<<coins<<"\n";
    if(coins==(int)(ph.size()))ph+=tab[2];
    else if(coins==(int)(ph.size()+1))ph+=tab[0];
    else ph+=tab[1];
    //cerr<<ph<<"\n";
  }
  if(press(ph+tab[0])==N)ph+=tab[0];
  else if(press(ph+tab[1])==N)ph+=tab[1];
  else ph+=tab[2];
  return ph;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...