hi everyone :)
i'm trying to solve 629D - Babaei and Birthday Cake in the last contest Codeforces Round 343 (Div. 2) ...
my idea got WA6 .. but i can't find why !! i followed the editorial can anyone help me :( here is my code 16335124
i already solved this problem 340D - Bubble Sort Graph
not sure of what you are doing here ... why sort the values by r*r*h ?
from problem statement
"in order to impress friends Babaei will put the cake i on top of the cake j only if the volume of the cake i is strictly greater than the volume of the cake j."
what you missed was that index of cake i is strictly greater than cake j
in other words i>j and V[i] > v[j]
I think it's because there's something wrong! Did you understand anything from that? I bet you didn't, you understood as much as anyone who wants to help you will understand from your blog. If you need your code to be debugged, you can't just post a piece of code (those macros make it too ugly) and say "Here's the code, here's the problem, where's the bug?" :) You must explain your solution in detail and then wish someone to help you :)
P_Nyagolov sorry for my previous language ... but this problem got stressed :(
Auto comment: topic has been updated by G_Hani (previous revision, new revision, compare).
I've read the code quickly, I'm not sure if this is the bug but in the line
ans[a[i].first] = query(1, 0, n - 1, 0, a[i].first) + a[i].second;
I doubt it should be
ans[a[i].first] = query(1, 0, n - 1, 0, a[i].first-1) + a[i].second;
because the sequence should be strictly increasing .Just a guess