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

Автор kostka, 12 месяцев назад, По-английски

We are excited to announce that the Baltic Olympiad in Informatics (BOI) 2025 will take place this week in Toruń, Poland.

The official contest will be held:

  • Dates: Saturday, April 26 and Sunday, April 27
  • Time: 09:00 — 14:00 (Central European Summer Time, UTC+2)
  • Live scoreboard: ranking.boi25.pl*

The public mirror contest will be held:

  • Dates: Saturday, April 26 and Sunday, April 27
  • Time: 10:00 — 15:00 (Central European Summer Time, UTC+2)
  • Contest link: mirror.boi25.pl (available starting Friday, April 25th)
  • Registration for the mirror contest will be available starting Friday, April 25 at 10:00 (CEST, UTC+2).
  • A practice session will be held on Friday, April 25, from 16:30 to 23:59 (CEST, UTC+2).

Technical details:

  • Format: IOI-style problems and scoring system.
  • Available languages: C++ and Python.
  • For all technical details, see the official website at boi25.pl.
  • The problem statements will be provided in English and national languages of the participating countries.**

Stay tuned for updates and good luck in the contest!

— BOI 2025 Organising Team


* The scoreboard will be turned on after the mirror contest starts (after 10:00).

** Assuming delegations choose to translate them. If your country participates in BOI and you are interested in problems statements in your national language, please check with your BOI delegation.

Update: The second day of the contest starts in 3 hours (at 10:00, CEST, UTC+2 time).

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

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

Can we do the mirror (day 1) as a virtual contest later (after 26 april 15:00)

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

will we have it on codeforces gym after it ends?

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

Will there be an editorial?

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

How to solve B?

I had this idea:

Create a new graph initally with M nodes. For each node track for every ingoing edge, the distint colors.

Now for each node and each color entering it create 3 nodes. We will call these nodes (u, c, 0), (u, c, 1) and (u, c, 2).

Now for an edge u -> v with color c and index id, add egde id -> (v, c, 0).

For every (u, c, 0) add edges to (u, c, 1) and (u, c, 2).

For every (u, c, 1) add edge to (u, prev(c), 1) and from every (u, c, 2) edge to (u, next(c), 2).

And add edge from (u, c, 1) to id and (u, c, 2) to id.

I suppose that every valid path in this graph will be valid in the initial, but I couldnt implement this in time.

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

The editorial and tests are available here: https://boi2025.mat.umk.pl/editorial_and_tests.php

You can also find the statements here: https://boi2025.mat.umk.pl/task_statements.php

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

Will the queue be fixed for Day 2?

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

Can someone help me understand why this solution for Gingerbread works?

Code

I kinda coded this as a joke and submitted it just for fun. It somehow got 100?

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

    In such number theory problems almost everything passes lol. I have a solution using DP which minimizes GCD given the number of operations. I have no idea why it's optimal to minimize GCD at each step. Also this solution didn't get 100 at first. Then I added if (1.0 * clock() / CLOCKS_PER_SEC >= TL) and it passed.

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

    Not sure what you are doing here, but here is some reasoning for why most reasonable solutions will get AC on the problem:

    • The answer for two given $$$a, b \leq 10^{7}$$$ is apparently always $$$\leq 4$$$ (in particular, the answer is always $$$\leq 4$$$), so for $$$n \leq 8$$$, say, one can bruteforce the up to $$$4^{8}$$$ possibilities and win. If your code does anything like this, it solves the answer for small $$$n$$$. By the way, note that we may also expect bruteforcing $$$4^{8}$$$ to take care of automatically a random testcase where the answer is $$$ \gt 4$$$, since these pairs are very rare and it is highly unlikely that $$$(a, b)$$$ and $$$(a+1, b)$$$ are both rare.

    • For larger $$$n$$$, say $$$n \geq 9$$$ with some simple arguments it can be shown that the answer is always $$$0$$$ or $$$1$$$, since the $$$9$$$th primorial exceeds $$$10^{7}$$$. As a result, any bruteforce that is optimised in the sense that it stops searching for suboptimal answers relative to an already found answer will always succeed quickly for $$$n \geq 9$$$, since it would have already found a working example with $$$\text{cost} = 1$$$.

    By the way, in case heuristics are unable to convince you the answer is low, I recommend looking at USA TSTST 2011/3, which proves that for two numbers $$$a, b \leq N$$$ we need no more than $$$O(\log N)$$$ steps to convert their $$$\gcd$$$ to $$$1$$$. Of course, this bound is very crude and in practice the answer is even lower.

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

      Amazing, thank you so much. Legit crazy that this just worked lmfao

      Edit: as to what I'm doing: I'm literally just brute forcing every way to distribute $$$i$$$ items across the $$$n$$$ elements of the array. There are:

      $$$\displaystyle \binom{i+n-1}{n-1}$$$

      ways to do this. If the $$$\gcd$$$ of the array becomes $$$1$$$ for any distribution, I just print $$$i$$$ and return immediately.

      If this didn't make sense please feel free to ask for clarification!

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

How to do A and B? Is A similar to the slope trick

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

    No. Problem A seems that you can write the brutest dp and optimize it by only recording the useful values of each $$$a'_i$$$. That is (for me), $$$a'_i$$$ is always in $$$a_{i\pm 0\sim 2}\pm 0\sim 4$$$ (maybe that's a very loose bound). Anyway, time complexity is absolutely $$$O(n)$$$.

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

    EDIT. The solution turned out to be wrong.

    Problem B (the incorrect fact is marked in bold)

    The hack is 1 1 1 2 3 4 ... N 1 1 2 3 4 ... N (thanks Milmon for this test and avighnakc for letting me know about it).

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

      In your solution you say we don't need to care about numbers that are less than $$$M - 2 \log_{2}(n)$$$. I'm assuming this is probably because they can't get big enough to have a significant difference on the answer (given that they can increase by $$$\log_2{n}$$$ at most). But why is this bound not something like $$$M - \log_2{n} - 1$$$ instead?

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

        I think the actual bound doesn't have this factor of 2 but my reasoning was like this: small numbers don't change much but having them in the middle might influence some bigger numbers (because we will eventually need to merge small elements with big elements), so we want to merge them into a single small number. So how much does it cost? The easiest way is to build an (almost) perfect binary tree on them. By doing it we increase the numbers by at most log, but if the number becomes greater than M — log it's no longer safe to assume that it won't become the maximum element. For example, if we have two big numbers, one was initially big and one became big enough after some operations why can't the latter one become the maximum if we do the operations treating this number as -infinity? Not obvious to me.

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

          Also, I thought of another strategy that seems promising. Do you think it's optimal?

          Solve with divide and conquer. At each level, choose the median occurence of the max element $$$M$$$, let that occur at index $$$k$$$. Then merge the left subtree $$$[1\dots k-1]$$$ and the right subtree $$$[k+1\dots n]$$$ recursively. Then if merging left with middle then right gives you a smaller value, do that, otherwise merge right with middle and then with left.

          I'll have to think about how queries are handled and I don't have a formal proof for this being correct either, but I'd still like to know whether it is or not.

          Also, sidenote: your solution assumes the following greedy algorithm is correct (which it is, but again, I don't have a proof for it): to get the smallest optimal value, merge $$$i$$$ with $$$i+1$$$ such that $$$\max(a[i], a[i+1]) + 1$$$ is minimized across all choices of $$$i \in [1, n)$$$.

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

      Apparently a new hack makes this solution fail: https://qoj.ac/submission/1079924

      Although I'm not sure what the exact hack is yet, I'm still trying to figure that out

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

Where will the problems be available for upsolving?

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

I’ve created a partially complete Codeforces gym to upsolve the problems from the contest, and you can find it here.

However, I’m currently missing solutions for a few problems and would greatly appreciate any help. If anyone has the full solutions for problems 2 and 3 from Day 1, and would be willing to share them, it would help me finalize the gym and move the problems over to Polygon. Everything else is ready to go.

The gym currently includes problems "Acronym," "Developer," "Exponents", and "Gingerbread."

Edit 2: Looks like all the problems are now on qoj.ac: day 1, day 2!

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

The problems are available on Eolymp.