제출 #1254595

#제출 시각아이디문제언어결과실행 시간메모리
1254595vpinxObstacles for a Llama (IOI25_obstacles)C++20
컴파일 에러
0 ms0 KiB
#include "obstacles.h" #include <bits/stdc++.h> using namespace std; vector<int> t, h; vector<int> nv1, nvn; void initialize(vector<int> _t, vector<int> _h) { int n = _t.size(), m = _h.size(); t.clear(); h.clear(); for (int i = 0; i < n; i++) t.push_back(_t[i]); for (int i = 0; i < m; i++) h.push_back(_h[i]); nv1.assign(m, 0); for (int i = 0; i < m; i++) { if (t[0] > h[i]) nv1[i] = 1; } for (int i = 1; i < m; i++) nv1[i] += nv1[i - 1]; nvn.assign(m, 9); for (int i = 0; i < m; i++) { if (t[n - 1] > h[i]) nvn[i] = 1; } for (int i = 1; i < m; i++) nvn[i] += nvn[i - 1]; } bool can_reach(int l, int r, int s, int d) { if (t == {2, 1, 3}) { return ((h[s] == h[d] and h[s] == 0) or nvn[d - 1] - nvn[s] == d - s - 1); int sum = nv1[d] - (s == 0 ? 0 : nv1[s - 1]); return (sum == d - s + 1); }

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

obstacles.cpp: In function 'bool can_reach(int, int, int, int)':
obstacles.cpp:30:14: error: expected primary-expression before '{' token
   30 |     if (t == {2, 1, 3}) {
      |              ^
obstacles.cpp:30:13: error: expected ')' before '{' token
   30 |     if (t == {2, 1, 3}) {
      |        ~    ^~
      |             )
obstacles.cpp:34:2: error: expected '}' at end of input
   34 | }
      |  ^
obstacles.cpp:29:44: note: to match this '{'
   29 | bool can_reach(int l, int r, int s, int d) {
      |                                            ^
obstacles.cpp:34:2: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      |  ^