Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

k1r1t0's blog

By k1r1t0, history, 13 months ago, In English

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
  • Vote: I like it
  • +32
  • Vote: I do not like it

| Write comment?
»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    13 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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 months ago, # ^ |
    Rev. 5   Vote: I like it +23 Vote: I do not like it

    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 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

https://glot.io/snippets/gpo6vt80f8