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

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

Tomorrow, the next SRM will be held at 07:00 EDT. Don't miss!

Have a nice SRM. Good luck :D

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

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

7 AM
SRM
Makes me regret
Choosing STEM

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

Can anyone tell me how to solve div1 500? Looks rather tricky for me.
I've seen several solutions, but still haven't got the whole idea.

UPD: OMG, second problem in last few weeks in which there's such "shortest-distance" graph is constructed and I don't manage to understand that the cycles can be only of length 2. Hopefully, I won't forget it next time.

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

    The number of connected components depends on the number of cycles. It can be proved that there exist only cycles between 2 vertices. Hence, we can reduce the problem into calculating the expected number of cycles between 2 vertices.

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

      calculating the expected number of cycles between 2 vertices.

      I got this far, but how to solve this kind of problem?

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

        For each vertex you can sort other vertices by priority (first distance, then y coordinate, then x).

        Then for each pair of vertices you want rabbits to NOT be in the cells that have higher priority compared to the picked vertices in at least one of the list.

        If there are n places for rabbits, r rabbits and e cells must be empty, the chance for that is C(n - e - 2, r - 2) / C(n, r) (two picked cells are already occupied by rabbits, which leads to minus 2). Add this chance to ans for each pair.

        That's O(n^6), not sure if it's quick enough, as I didn't implement it during the contest :c

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

      but the problem said the graph is undirected, so the cycles are edges between two points or not?

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

    A connected component as a directed graph always consists of cycle of size two and some vertices hanging on the cycle vertices as trees. Therefore number of components is equal to the number of cycles of size two.

    Expectation of this value is equal to sum of probabilities for every two empty cells of grid to form a 2-cycle. Two points form a 2-cycle iff no point is closer to the first point than the second, and vice versa; so, all points must lie outside some set. The probability for this is Csr - 2 / Cpr, where s is size of the set, p is number of empty cells.

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

      Congratulations for the victory!

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

      There exist people who denote Newton's symbol using that weird notation with Cij :OO!

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

      "A connected component as a directed graph always consists of cycle of size two and some vertices hanging on the cycle vertices as trees.". What if the connected component is a cycle of size 3, like 1 -> 2 and 2 -> 3 and 3 -> 1? It does not contain cycle of size 2.

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

Hmm, 1000 didn't seem tricky or really hard to me this time (meet in the middle), I wonder if the fails were due to TLE on constant/log factor...

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

    I think so too. If you had implemented it, you'd see that the time limit was very tight.

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

      I did implement it actually, but didn't manage to debug it in time :D

      (and now, I'm getting Uncaught exception in the practice room on something that should totally pass: an assignment in an existing map memlimit exceeded — speaking of which, didn't TC use to report memlimit exceeded specifically?)

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

    Yes, there were not enough time for me to make one simple optimization. And that's why my solution failed during contest

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

I was never able to solve the task 250 in regular DIV 1 (I solved some in TCO) during contest, but today I solved the task 500 :D

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

    But in SRM 635 you was able to earn 0 points but increase your rating, that looks strange :o

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

      Yeah, and not only my rating increased. It's pretty funny. Do nothing and earn points. :D Nowise it does not give much satisfaction, at least not me. I prefer well-deserved successes.

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

        Well, rating systems can act weird in unexpected situations (in this case, tricky 250). How much did you gain exactly?

        In a sense, you did well by not losing points :D

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

          I gained 4. xD

          And several contests ago in TCO 2A I gained 81 (also doing nothing), but then I was grey.

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

        It's always better try, than do nothing :)

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

can somebody explain, how to solve div2 1000?

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится
    • Binary search the lower bound of the minimum sum of the 16 sub-rectangles
    • brute force the 3 vertical cuts
    • greedily pick the horizontal cuts in order to exceed the lower bound
    • total complexity O(n^4 log n) .. using pre-calculated partial 2D sums