Submission #660146

#TimeUsernameProblemLanguageResultExecution timeMemory
660146Trisanu_DasWall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include "wall.h" #include <bits/stdc++.h> using namespace std; #define N 2000010; pair<int, int> seg[4 * N]; void update(int s, int e, int i, int l, int r, int cur, bool op){ cur = max(cur, seg[i].first); cur = min(val,seg[idx].second); if(l > e || r < s) return; if(l >= s && r <= e){if(!op) seg[i].first = cur; else seg[i].second = cur; return;} update(s, e, i * 2, l, (l + r) / 2, cur, op); update(s, e, i * 2 + 1, (l + r) / 2 + 1, r, cur, op); } void make(int l, int r, int i, int cur, int *ans){ cur = max(cur, seg[i].first); cur = min(cur, seg[i].second); if(l == r){ans[l] = cur; return;} make(l, (l + r) / 2, i * 2, cur, ans); make((l + r) / 2 + 1, r, i * 2 + 1, cur, ans); } void buildWall(int n, int k, int op[], int l[], int r[], int h[], int ans[]){ for(int i = 1;i <= 4 * n; i++) seg[i] = make_pair(0, INT_MAX); for(int i = k - 1; i >= 0; i--) update(l[i], r[i], 1, 0, n - 1, h[i], op[i] - 1); make(0,n - 1, 1, 0, ans); return; }

Compilation message (stderr)

wall.cpp:4:18: error: expected ']' before ';' token
    4 | #define N 2000010;
      |                  ^
wall.cpp:5:24: note: in expansion of macro 'N'
    5 | pair<int, int> seg[4 * N];
      |                        ^
wall.cpp:5:25: error: expected unqualified-id before ']' token
    5 | pair<int, int> seg[4 * N];
      |                         ^
wall.cpp: In function 'void update(int, int, int, int, int, int, bool)':
wall.cpp:8:17: error: 'seg' was not declared in this scope
    8 |  cur = max(cur, seg[i].first); cur = min(val,seg[idx].second);
      |                 ^~~
wall.cpp:8:42: error: 'val' was not declared in this scope
    8 |  cur = max(cur, seg[i].first); cur = min(val,seg[idx].second);
      |                                          ^~~
wall.cpp:8:50: error: 'idx' was not declared in this scope; did you mean 'index'?
    8 |  cur = max(cur, seg[i].first); cur = min(val,seg[idx].second);
      |                                                  ^~~
      |                                                  index
wall.cpp: In function 'void make(int, int, int, int, int*)':
wall.cpp:16:17: error: 'seg' was not declared in this scope
   16 |  cur = max(cur, seg[i].first); cur = min(cur, seg[i].second);
      |                 ^~~
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:23:33: error: 'seg' was not declared in this scope
   23 |  for(int i = 1;i <= 4 * n; i++) seg[i] = make_pair(0, INT_MAX);
      |                                 ^~~