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

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

This editorial corresponds to 2017 Chinese Multi-University Training, BeihangU Contest (stage 1), which was held on Jun 25th, 2017.

There are 12 problems in total. You can solve them as a team member or an individual in a 5-hour contest. By the time you join as virtual participants, 770 teams, or even more, will compete with you virtually.


Editorial in the English version has been completed, which is a bit different from its Chinese version (mostly because I don't want bad editorials to ruin the contest, lol). However, for the sake of hiding spoilers, editorials are locked and will be shown as the following conditions are met:

  • Editorials for the easiest 4 problems will be revealed after the replay (all unlocked);
  • Each for the hardest 5 will be released if the corresponding problem has been solved by at least 5 users or teams on Codeforces::Gym (all unlocked);
  • Each for the others will be published when the relevant problem has been solved by at least 10 users or teams in virtual participation (including the replay) on Codeforces::Gym (all unlocked).

Or you can find solutions in comments?


102253A - Add More Zero

Idea: skywalkert

solution

102253B - Balala Power!

Idea: sd0061

solution

102253C - Colorful Tree

Idea: sd0061

solution

102253D - Division Game

Idea: skywalkert

solution

102253E - Expectation of Division

Idea: skywalkert

solution

102253F - Function

Idea: chitanda

solution

102253G - Gear Up

Idea: constroy

solution

102253H - Hints of sd0061

Idea: constroy

solution

102253I - I Curse Myself

Idea: sd0061

solution

102253J - Journey with Knapsack

Idea: skywalkert

solution

102253K - KazaQ's Socks

Idea: chitanda

solution

102253L - Limited Permutation

Idea: skywalkert

solution

Hope you can enjoy it. Any comments, as well as downvotes, would be appreciated.

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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

Only A and K are unlocked. What about B and F?

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

I tried solving A like this (m * log10(2) + 1); But it's showing ans = 20 for m=64.which is wrong. while it shows correct output for m values=4,5,6, 7 and various others.

->And if i do floor(m * log10(2)); now it shows 19 for m=64 which is correct. while it shows wrong for m values = 4,5,6,7 and various others.

ANyone can help?

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

Can anyone post the solution of B

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

Can anyone explain Problem B? I am not able to understand problem statement.

Also can you explain how this ans came for this test case. Input- 3 a ba abc

Output- 18221

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

Sorry for necroposting.

What is the solution in expected sqrt(n*m) for H?

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

    And how to solve I in Klog(K) ?

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

      There is a problem requiring $$$\mathcal{O}(K \log K)$$$ algorithm. You can solve that problem on LibreOJ, or just view accepted solutions.

      Brief description:

      There are $$$n$$$ sets of numbers. The $$$i$$$-th set contains $$$c_i$$$ integers. Note that a value may be contained multiple times in a set, but every two copies are considered different.

      You can select one integer from each set, and then get a score equal to the total sum of the selected integers.

      You are asked to find $$$k$$$ possible schemes with the largest scores, and output these scores in decreasing order.

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

    What is the solution in expected sqrt(n*m) for H?

    It should be a typo.

    Split the range of values into $$$T$$$ blocks, and there are at most $$$m$$$ useful blocks. If generated elements are random enough, each block will contain $$$\frac{n}{T}$$$ elements. Erasing useless elements may help the further process, but it's just an optimization of constraints.

    I think the expected $$$\mathcal{O}(\sqrt{n m})$$$ should be $$$\mathcal{O}(n + \sqrt{n m})$$$.

    And how to solve I in Klog(K)?

    Just boost the process of sequence merging by data structures like Heap or SegmentTree (additional definition of states required).

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

is nlogn a typo in J editorial? The best solution I could get was nlog^2(n) using online fft to calculate the partition generating function.

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

    It can be done in $$$\mathcal{O}(n \log n)$$$ using Euler transform and Newton's method. These two approaches both require the knowledge of Taylor series expansion.


    Here's the detail for faster solving. Alert: TL;DR.
»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

skywalkert please release the editorial for problem E.

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

Hi, I am the original author of problem H. Recently I have found out a really elegant way to solve it.

Basically, we can realize the classic nth_element in linear time.
Then, what if we deal with the m positions at once?
Still, we use linear time partition, to partition array a[0, n) into three parts, [0, l), [l, r) and [r, n).
The positions(elem. of b) in [l, r) is definitly solved.
If any elements of b fall in [0, l), we go to solve sub-array [0, l) with those elements recursively. Also the same for [r, n).

This way is faster than the 'm times of nth_element', intuitively.
But the rigorous time complexity is quite difficult to prove.
Notice that b is arranged in a way so that most of sub-arrays of a is not encountered.
I roughly guess it O(n + m * log(n)).