Submission #1144880

#TimeUsernameProblemLanguageResultExecution timeMemory
1144880akamizane벽 (IOI14_wall)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; struct Node{ int mi = 0, mx = 1e9; }; Node t[4 * maxn]; int ans[maxn]; void apply (int id, int mi, int mx){ if (0 <= id && id < 4 * maxn){ t[id].mi = max(t[id].mi, mi); t[id].mx = min(t[id].mx, mx); t[id].mi = min(t[id].mi, mx); t[id].mx = max(t[id].mx, mi); } } void update(int id, int l, int r, int u, int v, int mode, int val){ if (r < u || v < l) return; if (u <= l && r <= v){ if (mode){ t[id].mx = min(t[id].mx, val); t[id].mi = min(t[id].mi, val); } else{ t[id].mx = max(t[id].mx, val); t[id].mi = max(t[id].mi, val); } return; } apply(id << 1, t[id].mi, t[id].mx); apply(id << 1 | 1, t[id].mi, t[id].mx); int mid = (l + r) / 2; t[id] = {0, (int)1e9}; update(id << 1, l, mid, u, v, mode, val); update(id << 1 | 1, mid + 1, r, u, v, mode, val); } void get(int id, int l, int r){ if (l == r){ ans[l] = min(t[id].mi, t[id].mx); return; } int mid = (l + r) / 2; apply(id << 1, t[id].mi, t[id].mx); apply(id << 1 | 1, t[id].mi, t[id].mx); get(id << 1, l, mid); get(id << 1 | 1, mid + 1, r); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int final_height[]) { for (int i = 0; i < k; i++) { update(1, 0, n - 1, left[i], right[i], op[i] - 1, height[i]); } get(1, 0, n - 1); for (int i = 0; i < n; i++) final_height[i] = ans[i]; }

Compilation message (stderr)

wall.cpp:9:12: error: 'maxn' was not declared in this scope
    9 | Node t[4 * maxn];
      |            ^~~~
wall.cpp:10:9: error: 'maxn' was not declared in this scope
   10 | int ans[maxn];
      |         ^~~~
wall.cpp: In function 'void apply(int, int, int)':
wall.cpp:12:29: error: 'maxn' was not declared in this scope; did you mean 'mx'?
   12 |     if (0 <= id && id < 4 * maxn){
      |                             ^~~~
      |                             mx
wall.cpp:13:9: error: 't' was not declared in this scope; did you mean 'tm'?
   13 |         t[id].mi = max(t[id].mi, mi);
      |         ^
      |         tm
wall.cpp: In function 'void update(int, int, int, int, int, int, int)':
wall.cpp:24:13: error: 't' was not declared in this scope
   24 |             t[id].mx = min(t[id].mx, val);
      |             ^
wall.cpp:28:13: error: 't' was not declared in this scope
   28 |             t[id].mx = max(t[id].mx, val);
      |             ^
wall.cpp:33:20: error: 't' was not declared in this scope
   33 |     apply(id << 1, t[id].mi, t[id].mx);
      |                    ^
wall.cpp: In function 'void get(int, int, int)':
wall.cpp:43:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |         ans[l] = min(t[id].mi, t[id].mx);
      |         ^~~
      |         abs
wall.cpp:43:22: error: 't' was not declared in this scope
   43 |         ans[l] = min(t[id].mi, t[id].mx);
      |                      ^
wall.cpp:47:20: error: 't' was not declared in this scope
   47 |     apply(id << 1, t[id].mi, t[id].mx);
      |                    ^
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:59:51: error: 'ans' was not declared in this scope; did you mean 'abs'?
   59 |     for (int i = 0; i < n; i++) final_height[i] = ans[i];
      |                                                   ^~~
      |                                                   abs