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

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

Hello Codeforces!

The Baltic Olympiad in Informatics 2024 is coming soon!

We are inviting everyone to take part in the Mirror Contest. It will consist of two competitions, each lasting five hours:

These times are given in the current Vilnius time zone. It is UTC+3!

The winners are announced here: https://boi2024.lmio.lt/news/mirror-contest/

Online (anonymous) ranking: https://mirror.cms.lmio.lt/ranking/ (will be open for a few days).

Onsite results: https://boi2024.lmio.lt/results/

Tasks: https://boi2024.lmio.lt/tasks/

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

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

I wish you all the best of luck.

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

will there be live standings?

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

    There won't be any public live standings. However, we will try to put some scoreboard after the contests.

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

Collides with Orthodox Easter.

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

Excited!

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

Is there any information about the registration published?

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

Mirror link?

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

Mirror registration and contest link updated at: https://boi2024.lmio.lt/news/mirror-contest/

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

How to solve Jobs for subtasks?

Btw, Trains and Jobs were interesting tasks!

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

    For S = 10^18, you can just do simple DP, because you just need to choose maximal sum of elements in tree, and some DP[node] = maximal profit if I choose that node, would pass.

    When tree is chain, then greedy like take node which you can take that would increase profit. You can simulate this easily.

    Full solution is to consider DP[node][minimal starting sum] = max profit. You can look how function f(minimal starting sum) = max profit changes. Main idea is to use slope trick. All you have to do now is some casework when you add positive/negative element. You should also use small to large to maintain slope points.

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

      Nice solution and the explanation! Aprreciate it.

    • »
      »
      »
      13 дней назад, # ^ |
      Rev. 6   Проголосовать: нравится +11 Проголосовать: не нравится

      My solution was simulating this greedy strategy:

      For each node store (min starting sum, profit) = $$$(v_i, d_i)$$$.

      Start with $$$d_i = x_i$$$, $$$d_0 = s$$$, $$$v_i = max(0,-x_i)$$$

      If for some node $$$i$$$ condition $$$d_i \geq 0 \land v_{p_i} + d_{p_i} \geq v_i$$$ holds, merge with parent to form $$$(v_{p_i}, d_{p_i} + d_i)$$$.

      Otherwise, find the node $$$i$$$ with min $$$v_i$$$ and $$$d_i\geq 0$$$ and $$$p_i\neq 0$$$ and merge with parent to form $$$(v_i - d_{p_i}, d_{p_i} + d_i)$$$.

      Answer will be $$$d_0$$$.

      Used small to large/dsu and priority queues for implementation.

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

        The intended solution was also a greedy strategy. But the slope trick solution also sounds very nice!

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

when will it be ok to discuss day1 problems?

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

Where can we find results of mirror contest?

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

How to solve Portal?

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

    My solution was to calculate the density of the n-1 vectors (in 2d) in Z^2, where the n-1 vectors are (a[i+1].x-a[i].x,a[i+1].y-a[i].y)

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

      Could you explain how did you calculate that?

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

        If you have 3 vectors, you can reduce it to 2.

        Notice, that you can change vector $$$v$$$ to $$$-v$$$ and vector pair $$$(a, b)$$$ to $$$(a, a+b)$$$ without changing the answer.

        Using this, reduce $$$2$$$ of the $$$3$$$ vectors to have $$$x = 0$$$ (euclidean algorithm), then you can change those 2 to $$$(0, gcd(a_y, b_y))$$$

        Somehow this needs __int128 precision

        EDIT: Doesn't need __int128, forgot some %= to keep the vectors small.

        • »
          »
          »
          »
          »
          13 дней назад, # ^ |
          Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

          That's what I thought about, but didn't manage to find the value of the second vector when I reduce the first one to x=0. I forgot about the Euclidian algorithm. Thanks! .

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

Where is the scoreboard ?

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

Aldas25 When will the analysis open?

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

Surprising fact about B:

The answer is 2 * gcd of areas of all NC3 triangles. I have no proof (good luck if you want to try). Unfortunately, I wasn't able to solve beyond N <= 2000 using this.

  • »
    »
    7 дней назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    If your claim is true, than this can easily be done in O(n): fix a point in the set P_0, and return twice the gcd of all areas of triangels of the form P_0 P_i P_i+1. any area of triangle p_i p_j p_k can represented as a linear combination of such areas, and therefore if a number g divides all areas P_0 P_i P_i+1, it will divide all areas P_i P_j P_k.

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

      i dont think this is correct (from experience since i submitted this too i think along with other heurestics). But, it is true that you only need to consider triangles passing through P_0

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

Is there any official solutions of problems?

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

    We will probably upload the solutions (and the task themselves) to the website after the olympiad.

    However, you are also free to share and discuss the solutions here. (note: after the mirror contest ends, of course)

»
12 дней назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

How to solve wall?

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

    Count the amount of water as $$$n$$$ — (open space) — (buildings) instead. Buildings are very easy to count (linearity of expectation, so to say). To count the open spaces (to the left), you use the formula $$$\sum_{i=1}^n (\prod_{j=1}^{i} a_j) 2^{n-i}$$$ or likewise, this can be counted with segment trees.

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

      Hmm, thinking about empty spaces is a lot easier lol. I was maintaining $$$dp_i[h] = \text{# ways of prefix 0...i max} = h$$$ in a segment tree for prefix/suffix. Then I updated the answer with $$$\sum_{i=1}^{n} i \times \sum_{h=0}^H min({a \lor b}_i, h) \times dp_{i-1}[h] \times 2^{n-i} $$$ and similarly with a negative sign from the other side.

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

        Thanks for the answer.

        I see you are from Lithuania, did you participate onsite?

        If you did, can you tell what were the medal cutoffs.

»
12 дней назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

Are there any simple implementation approaches to problem "tiles"?

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

    Change polygon to $$$x$$$ coordinate events $$$[y1, y2, open]$$$, then do sweepline.

    Start tiling the polygon from the left, then you will have some tiles with $$$x_2=x$$$ and some tiles with $$$x_2=x+1$$$. Store the y coordinate ranges for those. Treat the outside of the polygon as a tile.

    If the set $$$x_2 = x+1$$$ is empty, set the answer to $$$x$$$.

    To process an opening event insert it to the $$$x_2=x$$$ set.

    To process a closing event, the range must be contained within the $$$x_2=x$$$ set. Cut out the closing event range.

    After events, the $$$x_2=x$$$ ranges must have $$$y_1 = y_2 \mod 2$$$.

    After processing events increment $$$x$$$ and swap sets $$$x_2=x$$$ and $$$x_2=x+1$$$.

    My terrible code:

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

    I implemented the algorithm from this paper and it was reasonably simple.

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

Day 1 rankings now show rankings for day 2, please update the post

»
12 дней назад, # |
  Проголосовать: нравится +25 Проголосовать: не нравится

Why does the ranklist not contain usernames?

It is more fun to look at a non-anonymous leaderboard :D

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

    We did not collect the consent for showing names. We didn't want to deal with that legally, and also there could have been inappropriate names filled.

»
12 дней назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Official mirror results with names, when?

»
12 дней назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

How to solve problem B in both days. I managed to solve every thing else except these two (I really hate geometry lol)

»
12 дней назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

is there any scoreboard with names?

»
12 дней назад, # |
Rev. 2   Проголосовать: нравится +16 Проголосовать: не нравится
»
12 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

how to solve day2 p3 ?

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

How to solve full fires? I managed to solve the first 4 subtasks subtask using O(n^2) solution and add some randomization to pass the fifth one.

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

    Is there is interval i where Si > Ei, you change Ei to M + Ei.

    Observation 1: If there are more than 1 intervals equal Si, we will always choose the one with greatest Ei.

    Observation 2: If we are currently at interval i, we will jump to interval j, such that Si <= Sj <= Ei and Ei < Ej and Ej is maximal. If there are more best j, we take the one with smallest S.

    Now, we can build directed graph using the observations above.

    For each interval i, we will use binary search and binary lifting to find the first interval j, such that Ej >= Si + M.

    Note that we should build the graph in NlogN which can be achieved using segment tree.

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

    Choosing around 100 random starting points and checking each in O(n) also works.

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

      why is it true?

      imagine 2 segments that cover the whole space and the rest are small not optimal segments. what is the probability that you choose exactly one of those 2 segments out of 1e5 segments

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

        I forgot to say that you choose that random starting segments from the first 1000 longest segments.

        • »
          »
          »
          »
          »
          11 дней назад, # ^ |
          Rev. 2   Проголосовать: нравится +15 Проголосовать: не нравится

          I think the test cases were very weak, such a solution have passed during contest only fixing the largest segment, it obviously should not pass.

          how have you figured out that your solution is right. it is not clear to me, assume we have one large segment with length 10000 and inside that large segment we have 1000 segments with length 2. assume the optimal answer contains the largest segment, but we are picking 100 elements out of 1000 there is very low probability that we select exactly that largest one:

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

Is there something wrong with the following algorithm for d2p2? Or am I just too incompetent to implement it?

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

    Didn't read the whole thing but your second sentence is already suspicious to me, consider a polygon like

    .xx
    .xx
    xx.
    xx.
    
»
11 дней назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Does anybody know the official medal cutoffs?

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

When will tasks be published?

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

ojuz

Will you add these problems on oj.uz?

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

Can I submit code somewhere? Also the tasks zip file in the website doesn't work

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

good luck for all participants

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

The problems can be solved on Eolymp.