Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

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

How to solve BCF (preferably in a proved way)?

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

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

D: Is segmented ternary search the correct solution? I am getting WA10,so not sure if it's because my code is wrong or the approach is wrong

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

C: I permuted over the order of kings going to a new column. Other than that, I just made a valid move (either move current king in the order to a new column or just make other valid moves not clicking king)

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

In B I bruteforced 3 of the strings which have fewest question marks, then in the last string if we know either first or last symbol, we can find the other one, the same for the second and second to last symbol and so on. It works in $$$2^{26}n$$$, but passes in 1 second.

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

    If we don't know the two ends?

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

    Brute force from both borders to middle, with checking s for which all is known works in $$$O(2^{3n/4})$$$, because one ? in first two lines can be found because of modulo 4 equation, and one in last two lines can be found.

    In fact, you don't need to find them, this only proves, that for each s, at least 1/4 of branches will be thrown away imidiatly.

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

    The same proved complexity but probably faster in practice (and works in 5 ms): Do a recursive brute in this order: first and last column first, then going inside, and checking that currently everything is ok.

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

I have solved F with the following solution:

Bruteforce width of the first column(there are only O(1e6) interesting widths). Then, measure the width of the second column with ternary search by the answer.

Not sure, if it is correct or not.

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

Why 64Mb in F?

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

At first I've tried to solve B with MITM. But ML 64 MB was fighting against me. In the end I've solved it with local optimization.

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

How to solve J?

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

    You can find with DP in $$$O(n \cdot 2^n)$$$ that the answer is a linear recurrence of order $$$8$$$. So you can solve it with Berlekamp-Massey.

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

    Let $$$f[S]$$$ be the possibility that you start from $$$0$$$ to state $$$S$$$, where $$$S$$$ is a $$$n$$$-bit integer. The state means you are now at $$$0$$$ and a position $$$k$$$ is visited if and only if $$$S_k=1$$$.

    For each state $$$S$$$, find the first and last $$$11$$$, and set all the bits between them to $$$1$$$.

    i.e.

    0010101011000110000110101 -> 0010101011111111111110101

    It is not hard to prove that the number of states is now acceptable.

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

    Solution from my team: run random simulation multiple times, print arithmetic mean of number of moves in all simulations.

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

      Don't you need $$$10^{18}$$$ simulations to get the required precision ($$$10^{-9}$$$)?

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

        No, only about 10^11 simulations are required. So we had like non-polynomial which passed around 30 tests, and the rest 20 tests we passed with such a precalculation. One test proceeds in about 1 minute on my PC.

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

          When we repeat simulations $$$10^{11}$$$ times and take the average, the standard deviation of the result is multiplied by $$$1 / sqrt(10^{11})$$$. So it's very strange that this is accurate enough.

          My output for $$$n = 50$$$ is 3.845878128958. What's yours?

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

I'm doubtful about the validity of test 8 of problem D. I checked if the given polygon was convex, and it failed. Could anybody responsible for the problem take an inspection?