제출 #1211898

#제출 시각아이디문제언어결과실행 시간메모리
1211898LIA벽 (IOI14_wall)C++17
24 / 100
175 ms29888 KiB
#include "wall.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef tuple<ll, ll, ll> plll; typedef vector<plll> vplll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef vector<pll> vpll; typedef vector<vector<pll>> vvpll; typedef vector<vector<ll>> vvll; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; #define loop(i, s, e) for (ll i = (s); i < (e); ++i) #define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i) #define all(a) a.begin(), a.end() const ll inf = 1e9 + 7; vll h; ll n; void buildWall(int N, int k, int op[], int left[], int right[], int height[], int finalHeight[]) { n = N; h.resize(n); vplll updates; set<ll> idx; loop(i,0,n) idx.insert(i); vplll t1, t2; loop(i,0,k) { ll l = left[i],r = right[i],hi = height[i]; if (op[i] == 1) { t1.push_back({hi, l,r}); } else { t2.push_back({hi, l,r}); } } sort(all(t1)); reverse(all(t1)); sort(all(t2)); for (auto [hi, l,r] : t1) { auto it = idx.lower_bound(l); while (it!= idx.end() && *it<=r) { auto temp = it; it++; h[*temp] = hi; idx.erase(temp); } } loop(i,0,n) idx.insert(i); for (auto [hi, l,r] : t2) { auto it = idx.lower_bound(l); while (it!= idx.end() && *it<=r) { auto temp = it; it++; h[*temp] = min(hi, h[*temp]); idx.erase(temp); } } loop(i,0,n) { finalHeight[i] = h[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...