# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
763683 | PoonYaPat | Pinball (JOI14_pinball) | C++14 | 419 ms | 50720 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>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
pii s[1<<20];
pii merge(pii a, pii b) {return pii(min(a.first,b.first),min(a.second,b.second));};
void update(int l, int r, int idx, int x, ll val, int mode) { //0 - to left-most, 1 - right-most
if (x>r || x<l) return;
if (l==r) {
if (mode==0) s[idx].first=min(s[idx].first,val);
else s[idx].second=min(s[idx].second,val);
} else {
int mid=(l+r)/2;
update(l,mid,2*idx,x,val,mode);
update(mid+1,r,2*idx+1,x,val,mode);
s[idx]=merge(s[2*idx],s[2*idx+1]);
}
}
pii query(int l, int r, int idx, int x, int y) {
if (x>r || y<l) return pii(LLONG_MAX,LLONG_MAX);
if (x<=l && r<=y) return s[idx];
int mid=(l+r)/2;
return merge(query(l,mid,2*idx,x,y),query(mid+1,r,2*idx+1,x,y));
}
int mx,n,a[100001],b[100001],c[100001];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |