제출 #989769

#제출 시각아이디문제언어결과실행 시간메모리
989769mannshah1211Combo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
/**
 *    author: tourist
 *    created:
**/
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

vector<string> alphabet = {"A", "B", "X", "Y"};

int guess_sequence(int n) {
  string firs = "?", ans;
  for (int i = 0; i < 3; i++) {
    if (press(alphabet[i]) == 1) {
      firs = alphabet[i];
      break;
    }
  }
  if (firs == "?") {
    firs = alphabet[3];
  }
  ans += firs;
  vector<int> possible;
  for (int i = 0; i < 4; i++) {
    if (alphabet[i] != firs) {
      possible.push_back(i);
    }
  }
  for (int i = 1; i < n; i++) {
    for (int x : possible) {
      if (query(ans + alphabet[x]) == i + 1) {
        ans += alphabet[x];
        break;
      }
    }
  }
  return ans;
}

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

combo.cpp:18:5: error: ambiguating new declaration of 'int guess_sequence(int)'
   18 | int guess_sequence(int n) {
      |     ^~~~~~~~~~~~~~
In file included from combo.cpp:5:
combo.h:5:13: note: old declaration 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |             ^~~~~~~~~~~~~~
combo.cpp: In function 'int guess_sequence(int)':
combo.cpp:38:11: error: 'query' was not declared in this scope
   38 |       if (query(ans + alphabet[x]) == i + 1) {
      |           ^~~~~
combo.cpp:44:10: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
   44 |   return ans;
      |          ^~~