# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
26582 | dwarn | Bulldozer (JOI17_bulldozer) | C++14 | 1209 ms | 118008 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;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : (v))
#define sz(v) (int)(v).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
struct ST {
int n;
vector<ll> sum, mx, mn, ans;
ST(int _n) : n(_n){
while(__builtin_popcount(n) > 1) ++n;
sum.resize(2*n);
mn.resize(2*n);
mx.resize(2*n);
ans.resize(2*n);
}
void upd(ll dif, int pos){
for(pos += n; pos; pos /= 2){
sum[pos] += dif;
mn[pos] = min(0LL, sum[pos]);
ans[pos] = mx[pos] = max(0LL, sum[pos]);
if(pos < n){
mn[pos] = min(mn[pos], min(mn[2*pos], sum[2*pos]+mn[2*pos+1]));
mx[pos] = max(mx[pos], max(mx[2*pos], sum[2*pos]+mx[2*pos+1]));
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |