제출 #756142

#제출 시각아이디문제언어결과실행 시간메모리
756142thinknoexit콤보 (IOI18_combo)C++17
0 / 100
2 ms336 KiB
#include "combo.h"

std::string guess_sequence(int N) {
  std::string ans = "";
  char c[4] = { 'A','B','X','Y' };
  for (int i = 1;i < N;i++) {
    int mx = 0, idx = 0;
    for (int j = 0;j < 4;j++) {
      std::string p = "";
      for (int k = 0;k < 4;k++) {
        p += c[k] + ans + c[j];
      }
      int t = press(p);
      if (t > mx) {
        mx = t;
        idx = j;
      }
    }
    ans += c[idx];
  }
  for (int i = 0;i < 4;i++) {
    if (press(c[i] + ans) == N) {
      return c[i] + ans;
    }
  }
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:4:21: warning: control reaches end of non-void function [-Wreturn-type]
    4 |   std::string ans = "";
      |                     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...