tminh_hk20's blog

By tminh_hk20, 4 months ago,
• The first time I encountered this problem was 567E - President and Roads. I had an overflow error and WA in test 104: 233996380. Then, I just MOD the computational array by a prime number to avoid overflow, but it helps me Accept: 233999386. I was so surprised because I use MOD to fix overflow errors.
• The second time I encountered this problem was 348B - Apple Tree. I had an overflow error and runtime error on test 10: 236300131, and I did the same thing as Mod for a prime number. It's also helped me Accept: 236300470.
• I don't think Mod to avoid overflow is a technique to accept any problem like them, but I can't explain why it helps me Accept the 2 problems above. I think luck makes me Accept them.
• 0

By tminh_hk20, history, 6 months ago,

+) Problem: You have an array with N elements and Q queries. For each query, you update the value of range [l, r] by x, a[l], a[l+1],...,a[r] will become to a[l]+x, a[l+1]+x,...a[r]+x. After the query, you need to find the RES (Cutting the range The above number into segments, and the RES is equal to the total value of the segments. The value of A segment is defined by the difference between the largest and smallest numbers in that segment) +) N, Q<=2e5 +) -1e8<=a[i],x<=1e8

If you know some problem like this problem in Code force, I want you can share it for me.

I'm sorry about my English, Thank you for all!

• 0