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

Автор facug91, 10 лет назад, По-английски

Hi everyone, I'm looking for problems involving RSQ static. I know it's a very simple technic, but I need it for a class, to give them some problems to practice. I've solved a lot of problems with it, but I've never classified them, and weirdly I can't find any of them googling. Until now I have this two: http://codeforces.me/problemset/problem/313/B http://coj.uci.cu/24h/problem.xhtml?abb=2111 If someone has some others, from any judge, I'll appreciate it. Thanks!

Теги dp, rsq
  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится
»
10 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Thank you so much zxqfl, I didn't know that problem, and it's very interesting :). Anyway, I've been trying to solve it for a few hours, and always receive TLE. I've made the calculus, and should pass (tight, but still pass). Surely my approach isn't the correct one, and I'm thinking something wrongly. Here's my code. Basically what I did is update the first element a circle touches in each row, and the next element of the last one that a circle touch (range update, like in Fenwick Tree), then traverse all the grid updating each cell and saving the maximums. It should be O(n*m*3), around 9x10⁷ operations... I don't know, could you give me some clue about the solution? haha And thanks in advance :)

  • »
    »
    10 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

    Your solution is correct. The grader you're using to check your solution probably requires constant optimizations as well, so I tried to do some here (read the comments).

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

      So I wasn't as wrong as I thought haha. Thank you ffao, with your help I've finally got AC :)