제출 #503050

#제출 시각아이디문제언어결과실행 시간메모리
503050amukkalirCombo (IOI18_combo)C++17
5 / 100
0 ms200 KiB
#include "combo.h"
#include <bits/stdc++.h> 
using namespace std; 

string button[] = {"A","B","X","Y"};

string guess_sequence(int N) {
  string S = "";
  int met = -1; 

  for(int i=0; i<3; i++) {
    if(press(button[i])) {
      S += button[i]; 
      met = i; 
      break; 
    }
  }

  if(S.empty()) {
    S+="Y"; 
    met = 3; 
  }

  vector<string> p; 
  for(int i=0; i<4; i++) {
    if(i!=met) p.push_back(button[i]); 
  }

  int cnt = 3; 
  for(int k=1; k<N-1; k++) {
    string T = ""; 
    for(int i=0; i<3; i++) {
      T += S + p[0] + p[i]; 
    }
    T += S + p[1]; 
    int ask = press(T); 
    //cout << "press " << T << endl; 
    S += p[S.size() + 2 - ask]; 
    cnt++; 
  }

  if(press(S + p[0]) == N) S += p[0]; 
  else if (press(S + p[1]) == N) S += p[1]; 
  else S += p[2]; 

  // cout << N << " " << cnt << endl; 
  // cout << "my guess = " << S << endl; 

  return S; 
}


/*

N-1
1 kali nanya nebak 1 huruf 
2 kali nanya tp nebak 2 huruf 

*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...