Submission #660147

#TimeUsernameProblemLanguageResultExecution timeMemory
660147Trisanu_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[i].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: In function 'void update(int, int, int, int, int, int, bool)':
wall.cpp:8:42: error: 'val' was not declared in this scope
    8 |  cur = max(cur, seg[i].first); cur = min(val,seg[i].second);
      |                                          ^~~