제출 #863389

#제출 시각아이디문제언어결과실행 시간메모리
863389ArthasGlobal Warming (CEOI18_glo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end(); int N = 3e5 + 10, INF = 2e9 + 10; int n, x, a[N], l[N], ans; vector <int> v(N, INF); int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> x; FOR (i, 0, n){ cin >> a[i]; } v[0] = -INF; FOR (i, 0, n){ int p = lower_bound (all(v), a[i]) - v.begin(); v[p] = a[i]; l[i] = p; ans = max (ans, p); } FOR (i, 0, n){ v[i] = INF; } v[0] = -INF; for (int i = n - 1; i >= 0; -- i){ int p = lower_bound (all(v), -a[i] + x) - v.begin(); ans = max (ans, l[i] + p - 1); p = lower_bound (all(v), -a[i]) - v.begin(); v[p] = -a[i]; } cout << ans; return 0; }

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

glo.cpp:8:14: error: array bound is not an integer constant before ']' token
    8 | int n, x, a[N], l[N], ans;
      |              ^
glo.cpp:8:20: error: array bound is not an integer constant before ']' token
    8 | int n, x, a[N], l[N], ans;
      |                    ^
glo.cpp: In function 'int main()':
glo.cpp:15:8: error: 'i' was not declared in this scope
   15 |   FOR (i, 0, n){
      |        ^
glo.cpp:15:3: error: 'FOR' was not declared in this scope
   15 |   FOR (i, 0, n){
      |   ^~~
glo.cpp:4:33: error: expected ')' before ';' token
    4 | #define all(x) x.begin(),x.end();
      |                                 ^
glo.cpp:30:26: note: in expansion of macro 'all'
   30 |     int p = lower_bound (all(v), -a[i] + x) - v.begin();
      |                          ^~~
glo.cpp:30:25: note: to match this '('
   30 |     int p = lower_bound (all(v), -a[i] + x) - v.begin();
      |                         ^
glo.cpp:30:32: error: expected primary-expression before ',' token
   30 |     int p = lower_bound (all(v), -a[i] + x) - v.begin();
      |                                ^
glo.cpp:30:35: error: 'a' was not declared in this scope
   30 |     int p = lower_bound (all(v), -a[i] + x) - v.begin();
      |                                   ^
glo.cpp:31:21: error: 'l' was not declared in this scope
   31 |     ans = max (ans, l[i] + p - 1);
      |                     ^
glo.cpp:4:33: error: expected ')' before ';' token
    4 | #define all(x) x.begin(),x.end();
      |                                 ^
glo.cpp:32:22: note: in expansion of macro 'all'
   32 |     p = lower_bound (all(v), -a[i]) - v.begin();
      |                      ^~~
glo.cpp:32:21: note: to match this '('
   32 |     p = lower_bound (all(v), -a[i]) - v.begin();
      |                     ^
glo.cpp:32:28: error: expected primary-expression before ',' token
   32 |     p = lower_bound (all(v), -a[i]) - v.begin();
      |                            ^