제출 #686916

#제출 시각아이디문제언어결과실행 시간메모리
686916viwlesxq콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef string str; #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define F first #define S second #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)x.size() string guess_sequence(int N) { str res; vector <char> v; if (!press("X")) v.pb('X'); else res += 'X'; if (!press("Y")) v.pb('Y'); else res += 'Y'; if (!press("A")) v.pb('Y'); else res += 'A'; if (!press("B")) v.pb('B'); else res += 'B'; for (int i = 1; i < N; i++) { for (str ask : v) { if (press(res + ask) == i + 1) { res += ask; break; } } } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:7: error: 'press' was not declared in this scope; did you mean 'res'?
   21 |  if (!press("X")) v.pb('X');
      |       ^~~~~
      |       res
combo.cpp:23:7: error: 'press' was not declared in this scope; did you mean 'res'?
   23 |  if (!press("Y")) v.pb('Y');
      |       ^~~~~
      |       res
combo.cpp:25:7: error: 'press' was not declared in this scope; did you mean 'res'?
   25 |  if (!press("A")) v.pb('Y');
      |       ^~~~~
      |       res
combo.cpp:27:7: error: 'press' was not declared in this scope; did you mean 'res'?
   27 |  if (!press("B")) v.pb('B');
      |       ^~~~~
      |       res
combo.cpp:30:18: error: conversion from 'char' to non-scalar type 'str' {aka 'std::__cxx11::basic_string<char>'} requested
   30 |   for (str ask : v) {
      |                  ^
combo.cpp:31:8: error: 'press' was not declared in this scope; did you mean 'res'?
   31 |    if (press(res + ask) == i + 1) {
      |        ^~~~~
      |        res