Codeforces Round #415 (Div. 1), problem: (D) Hitchhiking in the Baltic States Solution In C/C++
#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; Node(){v=INF; siz=1; son=son=NULL; add=0;} void update() { siz=1; if(son!=NULL) siz+=son->siz; if(son!=NULL) siz+=son->siz; } …