Codeforces Round #179 (Div1 A, Div2 C) – Greg and Array

Problem description: C. Greg and Array

This problem is simple when you are fast with sweep line solutions. First you need to kwon that for each query the range [x, y] will be increased by one. This means that if a range [l, r] will be called 6 times the d value will be used 6 times on each value in the range. Sigue leyendo