lsmll's blog

By lsmll, history, 4 years ago, In English

Hello, Codeforces!

The China Collegiate Programming Contest (CCPC) is a competitive programming contest series for college students in China, organized by the CCPC Committee, which consists of coaches of the competitive programming teams of Chinese universities. It started in 2015, and this year is the 5th edition of CCPC. There are 4 onsite CCPC contests this year, including three regional contests in Qinhuangdao, Harbin and Xiamen, as well as the CCPC Final in Beijing. Many Chinese universities use CCPC as an opportunity to practice before the ICPC regionals.

The 2019 CCPC Harbin Site has recently ended on October 13 in Northeast Forestry University. A total of 272 teams, most of whom were selected from the preliminary online contest, took part in the official onsite contest in Harbin. The problems for this contest were mostly prepared by retired ICPC participants of Zhejiang University, and the head judge was me.

We are glad to invite you to participate in its online mirror: The 2019 China Collegiate Programming Contest Harbin Site in Codeforces::Gym! Please note that the mirror contest will start at Saturday, November 2, 2019, 18:00 (UTC+8). Click on the link to see when it starts in your timezone. We will be able to answer your questions during the mirror contest. The ghosts of the onsite participants are available, so you may take advantage of it.

This contest uses ACM-ICPC rules and of course, it is unrated. Team participation is recommended, but it is also possible to participate individually. As usual for Gym contests, you may register for this contest 6 hours before it starts, and you will be able to virtually participate and upsolve the problems after it ends.

My thanks go to:

We kindly ask everyone who has already know the problems not to participate or discuss them before the mirror contest has ended. Hope you enjoy the problems!

UPD: Contest has ended, thanks everyone for your participation. Here is the link to the official editorial, unfortunately it is in Chinese. But feel free to ask in the comments if you have any questions about the problems.

  • Vote: I like it
  • +291
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Auto comment: topic has been updated by lsmll (previous revision, new revision, compare).

»
4 years ago, # |
  Vote: I like it +169 Vote: I do not like it

One more proof that 300iq is Chinese

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

long awaited mirror game

»
4 years ago, # |
  Vote: I like it +11 Vote: I do not like it

How to solve A — Artful Paintings

  • »
    »
    4 years ago, # ^ |
    Rev. 3   Vote: I like it +14 Vote: I do not like it

    Binary search the answer. To check the answer, notice that each condition can be transformed into an inequality involving $$$pre_{l - 1}$$$ and $$$pre_{r}$$$, where $$$pre_x$$$ denotes the number of paintings chosen from the range $$$[1, x]$$$ i.e. the prefix sum up to $$$x$$$. Moreover, we have some more inequalities involving the prefix sums itself, such as $$$pre_i \leq pre_{i + 1}$$$ and $$$pre_n = pre_0 + \text{current_answer}$$$.

    Let's say we transform all inequalities into the same type $$$pre_x + u \geq pre_y$$$, then we add a directed edge from $$$x$$$ to $$$y$$$ with cost $$$u$$$ onto a graph. Our goal is to find a negative weighted cycle, and if such cycle exists then we cannot build the prefix sum array, else we can always build one ($$$pre_x$$$ is equals to the minimum distance from $$$0$$$ to $$$x$$$).

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      This is the intended soltion, but we have another $$$O(nm)$$$ solution without binary search.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Can you elaborate?

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it +21 Vote: I do not like it

          In binary search you need to check whether there is a negative cycle, so assume a cycle has the cost $$$A\times x+B$$$, we have $$$x\geq -\frac{B}{A}$$$.

          So let's just find the cycle with the minimum mean weight using some $$$O(n^2)$$$ formula.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you please explain what does an edge from x to y with cost u signify? It is not very trivial for me to understand.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        If we take the shortest path from node $$$0$$$ to every other node, then the edge from $$$x$$$ to $$$y$$$ with cost $$$u$$$ enforces that $$$d(x) + u \geq d(y)$$$, where $$$d(x)$$$ is the minimum distance from $$$0$$$ to $$$x$$$.

    • »
      »
      »
      4 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      How would you transform the second rule from the problem into such an inequality $$$pre_x + u \geq pre_y$$$? How would you transform $$$pre_i \leq pre_{i + 1}$$$ into a directed edge (let u = 0)?

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        $$$pre_{i + 1} + 0 \geq pre_i$$$, so directed edge of weight $$$0$$$ from vertex $$$i + 1$$$ to vertex $$$i$$$.

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Hello, sorry if this is a dumb question, but how would you transform this into such an inequality?

          The number of painted cubes whose index does not belong to the interval [Li,Ri] must not be strictly fewer than Ki (1≤i≤M2)

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            That means the number of painted cubes in the range $$$[L_i, R_i]$$$ must be less than or equal to $$$\text{current_answer} - K_i$$$.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I simulated some cases and found that it actually works but I have no idea why converting the inequalities to edges in such a way works for this problem.

      Can you suggest any article to gather some more in-depth knowledge/observations?

      Thanks

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

My submissions in this contest were moved to practice during this contest and I was unregistered. On registering again and asking for a clarification they replied that they didn't do it and It was a bug or someone else with coach rights did it. It was very displeasing and ruined the contest for me. I think it is trolling by some user which is obviously against CF rules. MikeMirzayanov please look into it. Thanks

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Is there any editorial available (maybe, not in English)?

How to solve D?

  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    We have official editorial in Chinese.

    D can be reduced to calculate the length of a segment or a parabola using intergration.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you please provide the link of editorial.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        I have put a link to the Chinese editorial in the post.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by lsmll (previous revision, new revision, compare).

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone tell how to solve L-LRU Algorithm

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Will there be mirror contest for CCPC 2019 final?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I don't know. The problem setters of CCPC Final this year are from Google China.

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

First time doing a Chinese contest :'(

On ABCEL, the top 5 teams had a cumulative 63 wrong submissions.

This contest had some harsh time limits.