# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154690 | junodeveloper | 허수아비 (JOI14_scarecrows) | C++14 | 691 ms | 69240 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int n;
pii p[200010];
vector<pii> tree[4*200010];
void update(int h,int tl,int tr,int x,int y) {
if(tr<y||y<tl)return;
while(!tree[h].empty()&&tree[h].back().se<y)
tree[h].pop_back();
tree[h].push_back({x,y});
if(tl==tr)return;
int mid=(tl+tr)/2;
update(h*2,tl,mid,x,y);
update(h*2+1,mid+1,tr,x,y);
}
pii query(int h,int tl,int tr,int l,int r,pii c) {
if(r<tl||tr<l) return c;
if(l<=tl&&tr<=r) {
if(tree[h].empty()) return c;
int i=lower_bound(all(tree[h]),make_pair(c.fi+1,-1))-tree[h].begin();
return {max(tree[h].back().fi,c.fi), c.se+sz(tree[h])-i};
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |