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

Автор k1r1t0, история, 13 месяцев назад, По-английски

104683A - Banis and Cards by Banis

Editorial

104683B - Left or Right Shift by wuhudsm

Editorial

104683C - Yet Another ÷2 or +1 Problem by wuhudsm

Editorial

104683D - Sum and Difference by Banis

Hint 1
Hint 2
Editorial

104683E - L-shaped Dominoes by chromate00

Editorial

104683F1 - Maximum Flow in DIV3?(Easy Version) and 104683F2 - Maximum Flow in DIV3?(Hard Version) by astilate

Hint 1
Hint 2
Hint 3
Editorial

104683G - Useless Trick by amenotiomoi

Editorial
Разбор задач TheForces Round #24 (DIV3-Forces)
  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

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

Editorial for $$$F1$$$ and $$$F2$$$ when? waiting since last night :(

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

    Here is my solution for F . note that max-flow = min — cut. so our goal is to find a partition of V into A and B , such that 1 is in A , n is in B. rest other vertices will be in one A or B. Size of cut = sum of weight of all edges from A to B. any vertex v > sqrt(n) won't be placed in B. a vertex v <= sqrt(n) will be placed in B iff. it is a divisor of n , else it will be in A. now you can compute the answer for a given n in sqrt(n).

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

    For $$$F1$$$, it is easier to see that flow for any given number $$$N$$$ is $$$N + \sum_{d \mid N}^{}min(d, \tfrac{N}{d})$$$. We can brute force for all the divisors of $$$N$$$ to compute this with resultant time complexity as $$$O(\sqrt{N})$$$.

    For $$$F2$$$, we can find the contribution of each $$$d$$$ on numbers in range $$$[L, R]$$$ First we have the contribution of each number itself that is $$$L + L + 1 + ... + R = \tfrac{R(R + 1)}{2} - \tfrac{L(L - 1)}{2}$$$

    since $$$R \leqslant 1e14$$$, it is sufficient to iterate till $$$1e7$$$ and get contribution of each number in range $$$[L, R]$$$.

    A number $$$d$$$ contributes to flow of $$$N$$$ as:

    • $$$2d$$$ if $$$d \mid N$$$ and $$${d_{}}^{2} < N$$$

    • $$$d$$$ if $$${d_{}}^{2} = N$$$

    Therefore, for any $$$d$$$ we can find the count of such numbers and calculate the total contribution of $$$d$$$ in range $$$[L, R]$$$ in $$$O(1)$$$

    Final answer will be $$$\tfrac{R(R + 1)}{2} - \tfrac{L(L - 1)}{2} + \sum_{2}^{1e7}contribution(d)$$$

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

    Sorry for late editorial. I've made it and updated now!

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

Can someone take a look why this DP on L-shaped Dominoes fails test 3

https://glot.io/snippets/gpo6vt80f8