Submission #584047

#TimeUsernameProblemLanguageResultExecution timeMemory
584047BackNoobWall (IOI14_wall)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define endl '\n' #define MASK(i) (1LL << (i)) #define ull unsigned long long #define ld long double #define pb push_back #define all(x) (x).begin() , (x).end() #define BIT(x , i) ((x >> (i)) & 1) #define TASK "task" #define sz(s) (int) (s).size() using namespace std; const int mxN = 5e5 + 227; const int inf = 1e9 + 277; const int mod = 1e9 + 7; const ll infll = 1e18 + 7; const int base = 307; const int LOG = 20; template <typename T1, typename T2> bool minimize(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maximize(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } struct IT{ int n; vector<int> tmax, tmin; IT(){} IT(int _n) { n = _n; tmax.resize(n * 4 + 7, 0); tmin.resize(n * 4 + 7, 0); } void push_down(int v) { maximize(tmax[v * 2], tmax[v]); maximize(tmax[v * 2 + 1], tmax[v]); minimize(tmin[v * 2], tmin[v]); minimize(tmin[v * 2 + 1], tmin[v]); if(tmax[v * 2] > tmin[v * 2]) { if(tmax[v * 2] == tmax[v]) maximize(tmin[v * 2], tmax[v * 2]); else minimize(tmax[v * 2], tmin[v * 2]); } if(tmax[v * 2 + 1] > tmin[v * 2 + 1]) { if(tmax[v * 2 + 1] == tmax[v]) maximize(tmin[v * 2 + 1], tmax[v * 2 + 1]); else minimize(tmax[v * 2 + 1], tmin[v * 2 + 1]); } } void update_min(int v, int tl, int tr, int l, int r, int val) { if(l > r) return ; if(tl == l && tr == r) { tmin[v] = min(tmin[v], val); tmax[v] = min(tmax[v], val); } else { int tm = (tl + tr) / 2; push_down(v); update_min(v * 2, tl, tm, l, min(r, tm), val); update_min(v * 2 + 1, tm + 1 , tr, max(l, tm + 1), r, val); tmin[v] = max(tmin[v * 2], tmin[v * 2 + 1]); tmax[v] = min(tmax[v * 2], tmax[v * 2 + 1]); } } void update_max(int v, int tl, int tr, int l, int r, int val) { if(l > r) return ; if(tl == l && tr == r) { tmax[v] = max(tmax[v], val); tmin[v] = max(tmin[v], tmax[v]); } else { int tm = (tl + tr) / 2; push_down(v); update_max(v * 2, tl, tm, l, min(r, tm), val); update_max(v * 2 + 1, tm + 1 , tr, max(l, tm + 1), r, val); tmin[v] = max(tmin[v * 2], tmin[v * 2 + 1]); tmax[v] = min(tmax[v * 2], tmax[v * 2 + 1]); } } void update_min(int l, int r, int val) { update_min(1, 1, n, l, r, val); } void update_max(int l, int r, int val) { update_max(1, 1, n, l, r, val); } int getans(int v, int tl, int tr, int pos) { if(tl == tr) return tmax[v]; else { int tm = (tl + tr) / 2; push_down(v); if(pos <= tm) return getans(v * 2, tl, tm, pos); else return getans(v * 2 + 1, tm + 1, tr, pos); } } int getans(int pos) { return getans(1, 1, n, pos); } } seg; void builWall(int n, int q, int op[], int lef[], int rig[], int h[], int ans[]) { seg = IT(n); for(int i = 1; i <= q; i++) { if(op[i - 1] == 1) seg.update_max(lef[i - 1] + 1, rig[i - 1] + 1, h[i - 1]); if(op[i - 1] == 2) seg.update_min(lef[i - 1] + 1, rig[i - 1] + 1, h[i - 1]); } for(int i = 1; i <= n; i++) ans[i - 1] = seg.getans(i); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccG6eNGn.o: in function `main':
grader.cpp:(.text.startup+0x133): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status