제출 #1132221

#제출 시각아이디문제언어결과실행 시간메모리
1132221bobthescience콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string p = ""; int r = 1, ord; vector<char> add = {'A', 'B', 'X', 'Y'}; for (char c :add) { if (press(c)) { add.erase(c); break; } } while (r < n) { for (char c :add) { if (press(p + c) > r) { r++; p += c; break } } } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:3: error: 'vector' was not declared in this scope
    8 |   vector<char> add = {'A', 'B', 'X', 'Y'};
      |   ^~~~~~
combo.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "combo.h"
  +++ |+#include <vector>
    2 | using namespace std;
combo.cpp:8:10: error: expected primary-expression before 'char'
    8 |   vector<char> add = {'A', 'B', 'X', 'Y'};
      |          ^~~~
combo.cpp:9:16: error: 'add' was not declared in this scope
    9 |   for (char c :add) {
      |                ^~~
combo.cpp:10:15: error: could not convert 'c' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   10 |     if (press(c)) {
      |               ^
      |               |
      |               char
combo.cpp:15:14: error: 'n' was not declared in this scope
   15 |   while (r < n) {
      |              ^
combo.cpp:16:18: error: 'add' was not declared in this scope
   16 |     for (char c :add) {
      |                  ^~~
combo.cpp:20:14: error: expected ';' before '}' token
   20 |         break
      |              ^
      |              ;
   21 |       }
      |       ~