When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

MarioYC's blog

By MarioYC, 12 years ago, In English
I was looking at solution 810236 from hpfdf and also other users, who only for every query "add l r d" do a for loop from l to r and make at most two update operations in a BIT.

Why does this work? I think something like this would do more than 109 operations.
  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it
I think the data is rondom,so the length of each query range is not large.I also used a BIT to solve this problem although it is not the best solution.
»
6 years ago, # |
  Vote: I like it -8 Vote: I do not like it

I think that because of this condition:

The operations are such that after all additions the array won't have numbers that would exceed 104