nguydavi's blog

By nguydavi, 11 years ago, In English

Hello ! I am new here and I have started to practice on problems in the GYM. First off, I am not sure if we are allowed to discuss the problem from the GYM so please tell me if I am out of bounds and I will delete my post.

I would really like some help on Problem B of 2014 BSUIR Open Programming Championship. Final

I get a time out on test 33. I believe in the worst case I would have to perform 10^10 operations in less than a second ! My only "optimization" so far is to sum all the terms related to (i-j) and multiply the result at once and do that for each pair of (i,j). I have also tried to do it concurrently in Java but the cost of creating BigIntegers are too much compared to using long long in C++.

I am out of ideas ! Can anyone help me ? :)

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

1010 is too much. In this problem, there is a much faster (not hard) solution.