제출 #1322320

#제출 시각아이디문제언어결과실행 시간메모리
1322320cesh콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h" using namespace std; using ll = long long; string guess_sequence(ll n) { vector<vector<ll>> is(n, vector<ll>(4)); string f = "AX"; ll c = press(f); string ans; vector<char> g; if (c >= 1) { f = "A"; c = press(f); if (c >= 1) { for (ll i = 1; i < n; i++) is[i][0] = 1; ans.push_back('A'); g.push_back('X'); g.push_back('B'); g.push_back('Y'); } else { for (ll i = 1; i < n; i++) is[i][1] = 1; ans.push_back('X'); g.push_back('A'); g.push_back('B'); g.push_back('Y'); } } else { f = "B"; c = press(f); if (c >= 1) { for (ll i = 1; i < n; i++) is[i][0] = 1; ans.push_back('B'); g.push_back('A'); g.push_back('X'); g.push_back('Y'); } else { for (ll i = 1; i < n; i++) is[i][1] = 1; ans.push_back('Y'); g.push_back('A'); g.push_back('X'); g.push_back('B'); } } for (ll i = 1; i < n - 1; i++) { string f = ans + g[0] + ans + g[1] + g[0] + ans + g[1] + g[1] + ans + g[1] + g[2]; c = press(f); if (c >= ans.size() + 2) ans.push_back(g[1]); else if (c >= ans.size() + 1) ans.push_back(g[0]); else ans.push_back(g[2]); } c = press(ans + g[0]); if (c >= ans.size() + 1) ans.push_back(g[0]); else { c = press(ans + g[1]); if (c >= ans.size() + 1) ans.push_back(g[1]); else ans.push_back(g[2]); } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(ll)':
combo.cpp:7:12: error: 'vector' was not declared in this scope
    7 |     vector<vector<ll>> is(n, vector<ll>(4));
      |            ^~~~~~
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 | 
combo.cpp:7:21: error: expected primary-expression before '>' token
    7 |     vector<vector<ll>> is(n, vector<ll>(4));
      |                     ^~
combo.cpp:7:39: error: expected primary-expression before '>' token
    7 |     vector<vector<ll>> is(n, vector<ll>(4));
      |                                       ^
combo.cpp:7:24: error: 'is' was not declared in this scope
    7 |     vector<vector<ll>> is(n, vector<ll>(4));
      |                        ^~
combo.cpp:11:12: error: expected primary-expression before 'char'
   11 |     vector<char> g;
      |            ^~~~
combo.cpp:18:13: error: 'g' was not declared in this scope
   18 |             g.push_back('X');
      |             ^
combo.cpp:24:13: error: 'g' was not declared in this scope
   24 |             g.push_back('A');
      |             ^
combo.cpp:34:13: error: 'g' was not declared in this scope
   34 |             g.push_back('A');
      |             ^
combo.cpp:40:13: error: 'g' was not declared in this scope
   40 |             g.push_back('A');
      |             ^
combo.cpp:46:26: error: 'g' was not declared in this scope
   46 |         string f = ans + g[0] + ans + g[1] + g[0] + ans + g[1] + g[1] + ans + g[1] + g[2];
      |                          ^
combo.cpp:52:21: error: 'g' was not declared in this scope
   52 |     c = press(ans + g[0]);
      |                     ^