Submission #989930

#TimeUsernameProblemLanguageResultExecution timeMemory
989930stdfloat벽 (IOI14_wall)C++17
0 / 100
223 ms262144 KiB
#include <bits/stdc++.h> #include "wall.h" using namespace std; vector<int> st; vector<vector<pair<int, int>>> lz; void LZ(int nd, int l, int r) { for (auto [op, h] : lz[nd]) { if (op == 1) st[nd] = max(st[nd], h); else st[nd] = min(st[nd], h); } if (l < r) { int ch = (nd << 1) + 1; lz[ch].insert(lz[ch].end(), lz[nd].begin(), lz[nd].end()); lz[ch + 1].insert(lz[ch + 1].end(), lz[nd].begin(), lz[nd].end()); } lz[nd].clear(); } int upd(int nd, int l, int r, int x, int y, int op, int h) { LZ(nd, l, r); if (r < x || y < l) return st[nd]; if (x <= l && r <= y) { lz[nd].push_back({op, h}); LZ(nd, l, r); return st[nd]; } int ch = (nd << 1) + 1, md = (l + r) >> 1; return st[nd] = max(upd(ch, l, md, x, y, op, h), upd(ch + 1, md + 1, r, x, y, op, h)); } int fnd(int nd, int l, int r, int x) { LZ(nd, l, r); if (r < x || x < l) return 0; if (l == r) return st[nd]; int ch = (nd << 1) + 1, md = (l + r) >> 1; return max(fnd(ch, l, md, x), fnd(ch + 1, md + 1, r, x)); } void buildWall(int n, int k, int op[], int l[], int r[], int h[], int fh[]) { st.assign(n << 2, 0); lz.assign(n << 2, {}); for (int i = 0; i < k; i++) upd(0, 0, n - 1, l[i], r[i], op[i], h[i]); for (int i = 0; i < n; i++) fh[i] = fnd(0, 0, n - 1, i); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...