Блог пользователя G_Hani

Автор G_Hani, история, 8 лет назад, По-английски

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

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

not sure of what you are doing here ... why sort the values by r*r*h ?

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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."

    • »
      »
      »
      8 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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]

»
8 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

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 :)

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by G_Hani (previous revision, new revision, compare).

»
8 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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