제출 #135170

#제출 시각아이디문제언어결과실행 시간메모리
135170Adhyyan1252콤보 (IOI18_combo)C++11
5 / 100
2 ms256 KiB
#include<string.h>
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;


std::string guess_sequence(int N) {
  int n = N;
  //find first lette
  string s = "ABXY";
  char f;
  string a = "AX";
  if(press("AB")){
    if(press("A")){
      f = 'A';
    }else{
      f = 'B';
    }
  }else{
    if(press("X")){
      f = 'X';
    }else{
      f = 'Y';
    }
  }
  //cout<<"WTf"<<endl;
  s.erase(s.find(f), 1);
  string ret = ""; ret += f;
  //cout<<"S "<<s<<endl;
  //cout<<"RE: "<<ret<<endl;
  //cout<<"F: "<<f<<endl;
  for(int i = 1; i < N-1; i++){
    string t = ret + s[0] + ret + s[1] + s[0] + ret + s[1] + s[1] + ret + s[1] + s[2];
    //cout<<"STRING "<<t<<endl;
    int coins = press(t);
    if(coins == i){
      ret += s[2];
    }else if(coins == i+1){
      ret += s[0];
    }else{
      ret += s[1];
    }
  }

  if(press(ret + s[0] + ret + s[1]) == n){
    if(press(ret + s[0]) == n){
      ret += s[0];
    }else{
      ret += s[1];
    }
  }else{
    ret += s[2];
  }
  return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...