Codeforces Round #415 (Div. 1), problem: (E) Surprise me! Solution in C/C++

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

#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<cstdio> #include<cmath> #include<cstdlib> #include<ctime> #include<queue> #include<set> using namespace std; typedef long long LL; const int N=4e5; int gi() { int w=0;bool q=1;char c=getchar(); while ((c<'0'||c>'9') && c!='-') c=getchar(); if (c=='-') q=0,c=getchar(); while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar(); return q? w:-w; } [...]

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() [...]