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

Автор BledDest, 3 года назад, По-английски

Hello Codeforces!

The Southern and Volga Russian Regional Contest was held in Saratov State University on 22nd of November. This contest was used to qualify the teams from Southern Russia and Volga region to the Northern Eurasia Finals.

On Nov/27/2022 13:35 (Moscow time), we will conduct the online mirror of this contest. It will last for 5 hours and is best suited for teams of three people, although it is not forbidden to participate in teams of smaller/larger size. The mirror will use ICPC rules, the same as the offline contest.

I would like to express my gratitude to all other jury members: awoo, Neon, vovuh, adedalic, DmitryKlenov, dmitryme, DStepanenko, elena and kuviman. Also, big thanks to the contest testers: IlyaLos, Oleg_Smirnov, ashmelev, pashka, and especially MikeMirzayanov not only for testing the problems, but also for his excellent Polygon system, without which it would be almost impossible to prepare the competition.

As a chief judge of the contest, I hope you enjoy the problems!

Of course, the contest will be unrated.

upd: The editorial can be found here.

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

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

Would the Southern and Volga Russia regional consider uploading test data for this year's (and also previous years') contests? The regional page is missing a lot of details.

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

Is $$$\mathcal{\color{red}{Hack}}$$$ available?

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

How challenging are the problems? Should I attempt to participate if I'm green?

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

excited

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

As a tester, I think that this is a really good set of problems. It will be of interest to a wide range of participants.

I'll add more. That, as a former chef judge, I highly appreciate the problems and think that the guys did a great job. Kudos!

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

It would be nice to finally fix language selector issue and remove excessive use of flags.

Sources with supporting arguments:

Codeforces Language Picker -- chrome extension to see how fixed codeforces language picker would look like.

Please support the initiative and stop reinforcing poor UX practices.

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

Is it rated?

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

Is this contes rated?

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

Interesting provlems. Thx

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

What is test 72 of problem I?

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

How to solve problem A ?

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

    Just https://e-maxx.ru/algo/path_cover (in Russian).

    Docs form a DAG. Duplicate the vertices, for each edge of DAG add the edge (i, j+n) to a new bipartite graph. Find the maximal matching. Edges chosen for matching form a path cover. Each path is then solved independently, and it is easy.

    Bad problem: it is not easy but at the same time it is just a copypaste from e-maxx.

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

      How do you deal with duplicate vertices? I was able to figure out the DAG part and then googled my way into the mcbm solution, but I am currently unable to solve when some documents have the same permissions.

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

        If two vertices are absolutely identical (the columns in the input are equal), just remember that one of them is the clone of the other and drop it from the rest of the solution except printing answer.

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

          hmmm that's what I did initially, guess it must be something else that's wrong lol. thanks

          EDIT: Ok i think my problem was decomposing the graph improperly (if $$$(i,j)$$$ is an edge and $$$(j,k)$$$ also an edge, I removed $$$(j,k)$$$ from the graph). :facepalm:

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

          There's an interesting way to handle identical documents (credit to ashmelev): use the document index as the tiebreaker. The method you described works just fine, but this one is a bit more elegant in terms of code.

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

What is the idea for solution problem D?

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

When will the editorial be published?

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

How to see the failed test cases ? I am not able to see it

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

How to solve problem K ?

  • »
    »
    3 года назад, скрыть # ^ |
    Rev. 4  
    Проголосовать: нравится 0 Проголосовать: не нравится
    Hint 1
    Hint 2
    Hint 3 (+ Answer)
    Solution Code
  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Only one type of shifting is available and dp.

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

how can i hack a solution when i can't see the author's code ?

update : problem solved!

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

How to solve Problem N?

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

    First, you have to minimize the number that will appear in the first position of the answer, using as few operations as possible. If you have more operations left, do it again with the second position. Repeat the same process until you run out of operations. I implemented it storing in 10 vectors all the positions of the numbers from 0 to 9, then performing binary search in each position. Be careful with the leading zeros, and also, at the end of the process you might still have operations, if there is no way of making the firsts positions smaller. Example: "1111111111..." Then you can just delete random digits that are still not deleted.

    Hope my explanation was not terrible.

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

      Now I kinda get the concept, though the implementation seems quite complex. I wonder how so many teams solved it.

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

        It's not that complex, but there must be simpler solutions.

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

        If you have to delete $$$k$$$ values then you have to keep $$$n-k$$$ values. Let's try to understand an approach to decide the first digit (leftmost) of the answer. It cannot be a $$$0$$$ and it has to be a value in the range $$$[0,k]$$$ (inclusive). Because if we were to take the $$$k+1th$$$ value then we won't be able to take $$$n-k$$$ values in total. Greedily we choose the smallest value in the range $$$[0,k]$$$ as our first value. Mark this index as $$$l$$$, now to choose our next value we apply a similar technique but we have to choose the least value in the range $$$[l+1,k+1]]$$$. Call this value $$$mn$$$ and update $$$l$$$ to the first occurence of $$$mn$$$ in the range $$$[l+1,k+1]$$$. We can do this naively since our $$$l$$$ pointer moves atmost $$$n$$$ times in total. Now do this approach again by finding minimum of the range $$$[l+1,k+2]$$$ and so on.

        To compute the minimum of the range, I just used a segtree. This makes the implementation quite easy imo — Submission

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

What was the order of problems in the onsite contest? Will you add ghosts?

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

    The order of the problems from the official competition was the following one:

    Spoiler

    I don't know how to add ghost participants, but I'll try to find it out and, if possible, add them.

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

About Problem J :

Spoiler
  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится
    Spoiler
  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +22 Проголосовать: не нравится
    Another spoiler, now about problem C
    • »
      »
      »
      3 года назад, скрыть # ^ |
       
      Проголосовать: нравится +8 Проголосовать: не нравится
      Spoiler for C
      • »
        »
        »
        »
        3 года назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        can you tell a bit more about the solution? i thought keeping the count distribution of the k cards is not enough because the selection algorithm may make the states heavily biased. it may not b the case that the remaining cards are uniformly distributed before the k cards.

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

          We just used linearity of expectation. Note that the contribution only depends on the distribution of the cards. For that you only need a multinomial distribution. For every possible size of your look-back, you can compute the distribution in $$$O(n^3)$$$, leading to an $$$O(n^4)$$$ solution.

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

How do you solve H?

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

How to solve H?

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

I'm kinda surprised so few participants solved L and G. They were much more popular on the official contest (all teams which solved 9 problems had G+H+L+6 easiest problems), and neither L nor G is especially hard.

On the other hand, A and F were the opposite of that: not solved on the onsite, popular during the mirror. Problem A is understandable, much more participants know the required techniques and can reduce the problem to those techniques; but F was considered one of the hardest problems in the set by me.

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

    When will the editorial be published?

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

    I think F is not difficult to solve it ,but maybe hard to prove it. I solved it by guessing.

    It is easy to find that we need to use DP to solve this problem in O(n^2). And then we guess dp[i]=min(dp[j]+f(j,i)) [1<=j<=i-1], try a try, ac is ok.

    If n<=300 the problem will be more difficult,I think.

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

      Proved by geometry, It actually relates to area below segments.

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

      Just upsolved it. Nothing hard, easier than A and L for sure. There was too much stress during the contest, but now it's much better.

      The problem is, in short: you can buy some points and in the end you gain the area under the top part of their convex hull.

      Solution of F
»
3 года назад, скрыть # |
Rev. 3  
Проголосовать: нравится +3 Проголосовать: не нравится

How solving problem E please ? I know this the problem solve math but how ?

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

J is absolutely beautiful. F and G are nice. Cool contest!

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

How to Solve L ?

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

Does anyone know what causes the verdict of hack showing "Unexpected verdict"?

I tried to hack some solutions (which seem to have wrong time complexity) for problem L, but I only got "Unexpected verdict".

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

How to solve problem H?

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

How to solve G?

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +8 Проголосовать: не нравится
    Spoiler
»
3 года назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Nevermind... You don't have to use all contracts...

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

Solution

This is the solution of Torus path (K) . Please help me i am not able to clear all test cases , i have tried with dp.

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

I recognize that for D it is simply to permute $$$a$$$ such that the least pairs $$$(a_i, a_{i+1})$$$ add to over $$$m$$$. To do this I use a simple greedy algorithm: for $$$a_x$$$ starting from smallest $$$a_x$$$, pair it with largest $$$a_y$$$ such that $$$a_x + a_y \leq m$$$. Then arrange pairs as such: $$$a_{y_1}, a_{x_1}, a_{y_2}, a_{x_2}, ...$$$. The remaining elements will always cause pairs that add to $$$\geq m$$$. I came up with this algorithm through intuition (it works). Is can somebody prove correctness?

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

Where can I find the editorial?

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

How to solve problem F ?

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

Not sure why does this solution work? 187063817 (why does this solution doesn't work without line 18: dp[i][j][t] = ans = -INF; should be just ans = -INF; from my knowledge it enters an infinite loop in this case).