Codeforces Round #415 (Div. 1), problem: (D) Hitchhiking in the Baltic States Solution In C/C++

By |2017-07-24T17:00:07+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #define nMax 300010 #define INF 2000000100 using namespace std; int n; struct Node { int v,siz,add; Node *son[2]; Node(){v=INF; siz=1; son[0]=son[1]=NULL; add=0;} void update() { siz=1; if(son[0]!=NULL) siz+=son[0]->siz; if(son[1]!=NULL) siz+=son[1]->siz; } void add_add(int a) { add+=a; v+=a; } void push_down() [...]