Submission #1346156

#TimeUsernameProblemLanguageResultExecution timeMemory
1346156comgaTramAnhCombo (IOI18_combo)C++20
30 / 100
7 ms456 KiB
#include <bits/stdc++.h> 
#include "combo.h"
using namespace std; 
string guess_sequence(int N) {
  string ret = "";
  ret += '.'; 
  char ch[4] = {'A', 'B', 'X', 'Y'}; 
  int firstChar = 'A'; 
  for (int i = 1; i < 4; i++) {
    ret.back() = ch[i]; 
    int len = press(ret); 
    if (len == 1) {
      firstChar = ch[i]; 
      break; 
    }
  }
  ret.back() = firstChar; 
  vector <char> options; 
  for (int i = 0; i < 4; i++) {
    if (ch[i] != firstChar) {
      options.push_back(ch[i]); 
    }
  }
  for (int i = 2; i <= N; i++) {
    ret += '.'; 
    char nextChar = options.back(); 
    for (int j = 0; j <= 1; j++) {
      ret.back() = options[j];
      int len = press(ret);
      if (len == i) {
        nextChar = options[j]; 
        break; 
      }  
    }
    ret.back() = nextChar; 
  }
  return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...