# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
672081 | neki | Izbori (COCI22_izbori) | C++14 | 978 ms | 36320 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 ll long long
#define vc vector
using namespace std;
struct segtr{
struct node{
node* lc=0,* rc=0;
ll sum=0,sum2=0, upd=0, l, r, mid;
node(ll l_, ll r_):l(l_), r(r_){mid=l+r;if(mid<0)--mid;mid/=2;}
~node(){if(lc)delete lc; if(rc)delete rc;}
inline ll getlen(){return r-l+1;}
inline ll getsum(){return sum+upd*getlen();}
inline ll getsum2(){return sum2+upd*getlen()*(getlen()+1)/2;}
void push(){
if(!lc) lc=new node(l, mid);
if(!rc) rc=new node(mid+1, r);
if(upd){lc->upd+=upd, rc->upd+=upd;upd=0;}
}
void updsums(){
sum=lc->getsum()+rc->getsum();
sum2=lc->getsum2()+lc->getsum()*rc->getlen()+rc->getsum2();
}
};
node* root;
ll n;
void update_w(ll ql, ll qr, node* no){
assert(ql<=qr && -n<=ql && qr<=n);
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... |