Submission #1299998

#TimeUsernameProblemLanguageResultExecution timeMemory
1299998khoavn2008Feast (NOI19_feast)C++17
Compilation error
0 ms0 KiB
update_range_assign_neg(p<<1|1, l, r); seg[p] = combine(seg[p<<1], seg[p<<1|1]); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); if (!(cin >> N >> K)) return 0; a.assign(N+1, 0); for (int i = 1; i <= N; ++i) cin >> a[i]; seg.assign(4*(N+5), Node()); build(1,1,N); ll ans = 0; for (int t = 0; t < K; ++t) { ll best = seg[1].best; if (best <= 0) break; int L = seg[1].bestL; int R = seg[1].bestR; ans += best; update_range_assign_neg(1, L, R); } cout << ans << '\n'; return 0; }

Compilation message (stderr)

feast.cpp:1:24: error: expected constructor, destructor, or type conversion before '(' token
    1 | update_range_assign_neg(p<<1|1, l, r);
      |                        ^
feast.cpp:2:5: error: 'seg' does not name a type
    2 |     seg[p] = combine(seg[p<<1], seg[p<<1|1]);
      |     ^~~
feast.cpp:3:1: error: expected declaration before '}' token
    3 | }
      | ^
feast.cpp: In function 'int main()':
feast.cpp:6:5: error: 'ios' has not been declared
    6 |     ios::sync_with_stdio(false);
      |     ^~~
feast.cpp:7:5: error: 'cin' was not declared in this scope
    7 |     cin.tie(nullptr);
      |     ^~~
feast.cpp:8:18: error: 'N' was not declared in this scope
    8 |     if (!(cin >> N >> K)) return 0;
      |                  ^
feast.cpp:8:23: error: 'K' was not declared in this scope
    8 |     if (!(cin >> N >> K)) return 0;
      |                       ^
feast.cpp:9:5: error: 'a' was not declared in this scope
    9 |     a.assign(N+1, 0);
      |     ^
feast.cpp:9:14: error: 'N' was not declared in this scope
    9 |     a.assign(N+1, 0);
      |              ^
feast.cpp:11:5: error: 'seg' was not declared in this scope
   11 |     seg.assign(4*(N+5), Node());
      |     ^~~
feast.cpp:11:25: error: 'Node' was not declared in this scope
   11 |     seg.assign(4*(N+5), Node());
      |                         ^~~~
feast.cpp:12:5: error: 'build' was not declared in this scope
   12 |     build(1,1,N);
      |     ^~~~~
feast.cpp:14:5: error: 'll' was not declared in this scope
   14 |     ll ans = 0;
      |     ^~
feast.cpp:15:25: error: 'K' was not declared in this scope
   15 |     for (int t = 0; t < K; ++t) {
      |                         ^
feast.cpp:16:11: error: expected ';' before 'best'
   16 |         ll best = seg[1].best;
      |           ^~~~~
      |           ;
feast.cpp:17:13: error: 'best' was not declared in this scope
   17 |         if (best <= 0) break;
      |             ^~~~
feast.cpp:20:9: error: 'ans' was not declared in this scope
   20 |         ans += best;
      |         ^~~
feast.cpp:20:16: error: 'best' was not declared in this scope
   20 |         ans += best;
      |                ^~~~
feast.cpp:21:9: error: 'update_range_assign_neg' was not declared in this scope
   21 |         update_range_assign_neg(1, L, R);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
feast.cpp:23:5: error: 'cout' was not declared in this scope
   23 |     cout << ans << '\n';
      |     ^~~~
feast.cpp:23:13: error: 'ans' was not declared in this scope
   23 |     cout << ans << '\n';
      |             ^~~