csacademy's blog

By csacademy, 8 years ago, In English

Hello, Codeforces!

CS Academy will host the online mirror of Romania's IOI 2017 Selection Contests. The first contest already took place on Saturday.

The second round will take place tomorrow, Monday, 08/May/2015 06:30:00 (UTC). The round will be rated for all users. You will have to solve 3 problems in 5 hours. The statements will be available in English and Romanian.

The third round will take place on Wednesday. As for the first round, we'll host the online mirror on Friday. Rounds 4, 5 and 6 will take place in a few weeks.

Contest format:

  • You will have to solve 3 tasks in 5 hours.
  • There will be full feedback throughout the entire contest.
  • The tasks will have partial scoring. The maximum score for each problem will be 100 points.
  • There will be no tie breaker, so two users having the same total score at the end of the contest will share the same place in the standings.

If you find any bugs please email us at [email protected]

Don't forget to like us on Facebook, VK and follow us on Twitter.

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

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

Will virtual participation be possible with these rounds?

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

Man, what kind of programmers do Romanians select? This contest is soooo hard.

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

    geniucos, Andrei1998 and AndreiNet were top 3 after the first selection contest. We need hard problems to break the tie between them.

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

      Yep I know, I occasionally chat with geniucos about their contests. I just wanted to say that they must be really good to solve these problems, I can't do anything on them :D

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

      or maybe you need hard problems to break them.

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

Can you describe your solution for the third task?

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

    Solve it in O(N*M*log(N)) using some DP, then reduce the O(log) to O(log*), then reduce one dimension using the trick from IOI 2016 aliens ^_^ It's one of the nicest problems I've seen recently.

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

      Reyna tried that trick, but it didn't work. Did you manage to get your solution accepted?

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

        not yet, but I know the solution from the author of the task, bicsi . He promised me a beer if I can get it AC, so I'll probably code it soon. :))

      • »
        »
        »
        »
        8 years ago, # ^ |
        Rev. 5   Vote: I like it +21 Vote: I do not like it

        Hello, I am the problem setter for Popcorn.

        The official solution uses the linear binary search optimization trick seen at IOI 2017 Aliens, along with a data structure that will be described below:

        Let DP[i][j] =  the solution where we choose i points and we consider intervals that have the right end less than or equal to j. The recurrence is: DP[i][j] = maxx{DP[i - 1][x - 1] + C(x, j)}, where C(x, j) is the total weight of the ranges that have l ≤ x ≤ r ≤ j.

        We use sweep line to calculate DP[i][ * ]. Let Val[x] = DP[i - 1][x - 1] + C(x, j) in our sweeping. When we go from j - 1 to j, we do 2 things:

        1. We update Val[j] = DP[i - 1][j - 1]
        2. For each range (a, j) of weight w we add w to Val[a], Val[b], ..., Val[j]

        The data structure should, at any time, give out the answer for maxx{Val[x]}.

        Obviously, this can be done with a segment tree. Not so obvious is the fact that it can be improved with disjoint sets:

        Notice that, if at any time we have Val[x] ≤ Val[y] with x < y, x will never be a solution anymore. We can keep a list of (strictly) decreasing values. However, we have to be able to append to the list and increment arbitrary suffixes of it. Appending is easy, and adding suffixes can be managed by keeping differences of consecutive elements (i.e., Incr[x] = Val[x] - Val[x - 1]). Note that for each increment, if at some time Incr[x] ≥ 0, we will "merge" x with the element right before it, adding its increment. If we use DSU for this process, we get an amortized complexity of O(n * log * (n)) for each step in our dynamic. Note that when appending to this increment array, you actually have to subtract the sum of the increments in the data structure to keep the property.

        Obviously, the maximum value will be the first element of the list.

        This is the solution in complexity O(n * m).

        Obviously, this can be adapted to work with the binary search trick, giving a total complexity of O(n * log(109) * log * (n)) for 100 points.

        Interestingly enough, the solution for 100 points has about 2kb source size and less than 100 lines of code.

        • »
          »
          »
          »
          »
          8 years ago, # ^ |
          Rev. 2   Vote: I like it +16 Vote: I do not like it

          The official solution uses the linear binary search optimization trick seen at IOI 2017

          Don't hesitate to give more info about this contest :D

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

            Say Ans(k) is the answer for k bags. Then, because Ans(k) - Ans(k - 1) ≥ Ans(k + 1) - Ans(k), you can solve the answer for M boxes in the following manner (in short):

            Consider a reduced problem, where you have an infinite number of bags, but taking a new bag has a cost λ. You can solve this problem in O(n * log * (n)) time, in a similar manner described above.

            It is clear that, as λ gets bigger, the solution to the reduced problem will yield fewer bags. Now, because that inequality above is true, there always exists a λM for which the solution to the reduced problem yields M bags (this comes from the fact that no linear function of form Ans(i) - λ * i lies below the upper convex hull of all of them).

            You binary search for that λM. After finding that particular λM, you just output the solution to the reduced problem, adding back the cost for the M bags (i.e., output ans + λM * M)

            Of course, the algorithm of computing the solution to the reduced problem should also keep track of the number of bags used, which is not that hard.

            This "trick" has been made famous by the IOI 2016 problem "aliens", which can be seen here: http://www.ioi-jp.org/ioi/2016/tasks/day2-aliens-ISC.pdf

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

By the way, on problem popcorn, there were two more 75-point subtasks (the most relevant ones) that were not included on csacademy's simulation of the contest. Here is a link of the problem with all the original subtasks (albeit in Romanian, not English):

http://www.infoarena.ro/problema/popcorn

»
6 years ago, # |
Rev. 2   Vote: I like it +32 Vote: I do not like it

Any hints on the first problem Meow? I didn't quite get the official editorial.