http://codeforces.com/contest/1108/problem/E1


이건데


이거 해답지에


직관적인 방법의 시간복잡도는 n * n * m 나오고


구간합을 쓰면 n * (n + m) 이 나온다는데


구간합을 어떻게 적용시켜야됨?