Submission #1146781

#TimeUsernameProblemLanguageResultExecution timeMemory
1146781kvintsekstakord콤보 (IOI18_combo)C++20
100 / 100
7 ms604 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string chars = "ABXY";

string guess_sequence(int N) {
  
  string S = "";
  if(press("AB")){
    S+=(press("A") ? 'A' : 'B');
  }else{
    S+=(press("X") ? 'X' : 'Y');
  }
  vector<char> first;
  for(int j = 0; j < 4; j++){
    if(chars[j]==S[0]) continue;
    
    first.push_back(chars[j]);
  } 
  for(int i = 0; i < N-2; i++){

    vector<string> opts;
    for(int j = 0; j < 4; j++){
      if(chars[j]==S[0]) continue;

      string opt = S;
      opt+=first[0];
      opt+=chars[j];
      opts.push_back(opt);
    }
    opts.push_back(S+first[1]);

    int res = press(opts[0]+opts[1]+opts[2]+opts[3]);

    if(res==i+3) S+=first[0];
    else if(res==i+2) S+=first[1];
    else S+=first[2];
  }

  if(N>1){
  
    if(press(S+first[0]+S+first[1])==N){
      if(press(S+first[0])==N){
        S+=first[0];
      }else S+=first[1];
    }else S+=first[2];
  }

  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...