Hi All, I'm getting a strange precision error in this problem : 284C - Cows and Sequence and this is my code : 3346105 I know that this problem could be solved by many other ways , but what's wrong with this implementation ? I'm using a segment tree with lazy propagation , every node contains three integers , the value of the node ( which is the summation over this range ) the update flag ( and value ) and the number of leafs under this node.
Thanks :)
UPDATE : The problem was that integers overflow and the size of the vector was causing some problems too , Thanks to EarlOfDitches and here is my accepted solution 3348952 :)
Most probably, the issue is in data overflow. You used int type for sum, use 64-bit integers.
3346174 still getting WA in the same line.
Use long long or double. There is integer overflow.
3346174 still getting WA in the same line.
It's running
UPD Aaaaand it's failed xD I'm still working on it!
I done it!
Problem was in long long and size of vector.
Ok , Thank you very much :)