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

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

AtCoder Grand Contest 003 will be held on Sunday (time). The writer is DEGwer.

Contest Link

Contest Announcement

Let's discuss problems after the contest.

Also, we've just announced Code Festival 2016!

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

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

I'm new to your site where to register in the contest?

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

Thanks for holding those contests!

Would it be possible for you to maintain an official Google Calendar with contests, like TopCoder does, so that one can import it and never miss a round?

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

I'm looking forward to seeing you in the contest!

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

I solved last time's F (when upsolving) in around 10 minutes and had much more trouble with D/E, so I intended to start from the hardest problem now, but after reading it... no way.

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

    Actually F is not hard if you notice that you don't have to deal with the complicated case(connected in both side)... But I didn't even notice that black cells are connected Orz

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

What is the intended solution for E?

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

    Please check "Editorial" tab for intended solutions.

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

    I solved it by expressing the array after each query as previous arrays and some prefixes of the initial array, then as just prefixes of the initial array. I maintain a prefix of some array, find the first time this prefix was formed (the latest array before it that has length less than this prefix), then split it into a prefix of this smaller array plus its  ≥ 1 whole copies. This can only be repeated times, since the length of this current prefix always decreases at least twice; the total time complexity is using good RMQ to find the last smaller element.

    And I just noticed after looking for you in the scoreboard, sorting by name shouldn't be case sensitive...

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

http://pastebin.com/dr4fzuLT For B , any Test Case where greedy strategy of making pairs in increasing order fails?

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

I missed the "all black cells are connected" condition in problem F and marvelled at the number of AC solutions while having exactly zero ideas how to solve it.

Does anyone have any clue how to solve this problem in general case?

And by the way, the problems were awesome, thanks a lot!

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

    At least I couldn't find the solution in general case when I made this problem.

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

Can D be solved using some sort of inclusion-exclusion?

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

Testdata for problem D is too weak, my code takes more than 10 seconds in this case: generator.

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

    Sorry, that's my fault. Generator contained some bug so there are no case that consists of around 100000 distinct primes, although I tried.

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

I am wondering whether this solution to E is correct:

Let's define B sequence as in editorial(increasing suffix minimums). Build a segment tree with min(N, B[0]) ones. Next, let's process B sequence.

In i-th step multiply whole array by max(1, B[i + 1]/B[i]) and then add 1 to range [1, B[i + 1] % B[i]]. We can then restore the answer by querying the tree : Sum[1,1], Sum[2,2] etc. In this solution time complexity is O(N log N + Q log N), so I think it's better than editorial one.

Tree can be build like in this editorial : https://discuss.codechef.com/questions/72277/addmul-editorial

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

In C, I used two priority queues. I stored all even indexed elements in one and odd indexed in the other. The I alternatively started popping the first queue, if q1.top() <= q2.top(), I just pop it else I popped q2 and pushed q1.top() to q2 and incremented a counter variable.

I then printed the counter variable. This gave me WA in last 7 test cases. Although the intended solution is much easier, I just want to know what is wrong with my approach. Thank you.

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

begin sob story During contest, I submitted correct solution to problem E but with unneccesary cout statements. The grader gave me verdict TLE because I printed too many of these, but I assumed my program was too slow and went to problem F.

After contest commenting out 3 lines of cout gives AC.

(http://agc003.contest.atcoder.jp/submissions/847933,

http://agc003.contest.atcoder.jp/submissions/848807)

end sob story

But I personally think that the grader should give feedback on sample inputs.

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

    Did you see the details during the contest? There are some WA in it.

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

    Mmm, there are sample tests at the bottom. Weren't them there during the contest too? Btw, my condolences :|

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

    You have no idea how many times this (or leaving a bruteforce/generator from debugging in the code) has happened to me. That's why I check all couts in my code before submitting and test it on samples. Sometimes, I still forget and get a WA, but it's been happening much less often lately.

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

      Ok, looks like I am not yet experienced with these contests or AtCoder interface yet, I did forget to click details.

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

Did everyone who solved D used same approach as editorial?

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

How to solve D? I am not able to understand editorial.

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

    In which part do you have a trouble? Computing Pair(t)? Something else?

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

      What exactly are we doing after calculating pairs and norms ?

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

        Consider a graph where each vertex corresponds to a number and there is an edge between two vertices if the product is cubic. This graph will be a set of complete bipartite graphs, so the size of max independent set is (total number of vertices) — (max matching). Max matching can be computed greedily by eliminating edges one by one.