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

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

Note that initially this contest was scheduled on a different day. Due to technical difficulties, we had to postpone the online mirror. We are sorry about that; if you planned to participate, but are no longer able because the contest day has changed, you can use the virtual participation option.

Hello Codeforces!

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

On Nov/18/2024 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.

The contest was prepared by adedalic, awoo, dmitryme, elena, Neon, DmitryKlenov, MikeMirzayanov, Ferume and me. Big thanks to the contest testers: Kuroni, ashmelev, bthero, KIRIJIJI, Kniaz, vladmart, JanPlovLagman, PropeRam, pshenikita. I would like to express my gratitude to MikeMirzayanov for not only participating in the preparation process himself, but also making Polygon, which made our work much easier.

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

Of course, the contest will be unrated.

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

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

Is it possible to see rated 5 hours long team contests in codeforces in future?

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

Excuse me, in the online mirror, is it valid for the team members to use different computers at the same time? For the past ICPC-style contests on Codeforces, there are both cases of "yes" and "no".

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

i am looking for a team...

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

Exuse me, what does it mean that the registration screen number box is red?

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

it is not forbidden to participate in teams of smaller/*larger size*

Codeforces tells me "You should select between 1 and 3 team members" :thinking:

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

Woohoo!

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

H is quite cool

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

Thank you for participation! We hope you enjoyed the problems.

You can access the solution slides (ordered according to the difficulty level, or at least how we perceived it) here: in Russian, in English.

Problems were authored and prepared by:
»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

wrong answer Provided points do not form a rectangle with sides parallel to axes: (94, -50), (94, -39), (94, -32), (94, -29) (test case 5518)

why?

ok understood now but atleast give definition of degenerate rectangle in problem statement, I thought like triangle collinearity assures degneration

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

for L bridge renovation, is it a direct greedy? or do permutations for order of operations which take as many as possible ? and is dp possible?

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

Can F be solved without FFT? Otherwise I find it really weird that so many teams solved it in contest. Like, how is this about as solved as problem I which could have been literally done with some simple hashes??

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

Can someone can provide a proof for the solution claim in Problem G :

  • For each character, except the last, there is a next character — 1 or 0.
  • Based on this, we can ask the following queries — 1, 11, and 10.
  • After each 1, except the last, there will be a character, so if the answer to the first query equals the sum of the other two, then the last character is not 1
»
2 года назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Hi! I'm just curious — according to official standings, nobody has solved C and G, but they were quite easy here.

Image

So what was the original order?

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

How to solve B?

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

    I referred to Jiangly's submission 292165413. He made all the elements of array equal and less than 3 (if possible) while storing the count of number of operations required on each index and if it's possible the minimum operations can be achieved by simply subtracting minimum value of an operation on any index times n from total number of operations......

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    // this is solution ? 
    

    I solved it a bit differently. Let $$$f[i]$$$ be the number of operations you apply at $$$i$$$. Note that $$$f[i]$$$ is cyclic, meaning $$$f[i] = f[i + N]$$$. Let the final element be $$$x$$$. Then, we must have:

    Unable to parse markup [type=CF_MATHJAX]

    If you solve this equation for $$$f[i]$$$ (I took $$$N = 5$$$ as a reference), you find:

    $$$ f[i] = -x + \frac{a[i + 1] + 2a[i + 2] + 4a[i + 3] + \cdots + 2^{N - 1}a[i]}{2^N - 1}. $$$

    Let the second term be $$$q[i]$$$, where:

    Unable to parse markup [type=CF_MATHJAX]

    Observe that $$$q[i]$$$ satisfies the recurrence:

    Unable to parse markup [type=CF_MATHJAX]

    Thus, we can compute $$$q[N - 1]$$$ first and then evaluate all $$$q[i]$$$. However, if $$$q[N - 1]$$$ is not an integer, we immediately print

    Unable to parse markup [type=CF_MATHJAX]

    .

    Additionally, since

    Unable to parse markup [type=CF_MATHJAX]

    for all $$$i$$$, it follows that

    Unable to parse markup [type=CF_MATHJAX]

    . The final answer is:
    $$$ \sum_{i=0}^{i = N - 1} f[i] = -Nx + \sum_{i=0}^{i = N - 1} a[i]. $$$

    Hence,

    $$$ x = \min_{i = 0}^{N - 1} q[i]. $$$

    After this, we check whether $$$x$$$ is non-negative and then print the final answer.

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

Problem D : Is it possible for Java code to fit in the 3s time limit? (Tried lots of optimization, still got TLE)

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

    solution: First enumerate offline all distinct OR-value intervals ending at each i → sort those intervals in ascending order of their OR value → perform an online DP using a Fenwick tree. When dealing with large data scales such as 2e5 or even 1e6, it’s critical to avoid small objects and wrapper classes like Integer, int[], record Segment(...), or data structures like PriorityQueue and PriorityQueue<int[]>—especially when performance matters. These objects carry significant overhead due to Java’s object model: every object includes a header, introduces pointer indirection, and scatters data across the heap, leading to poor cache locality. Unlike Rust and c++ where structs are often plain, tightly packed value types, Java’s heap-allocated objects are far less memory-efficient and CPU-friendly. In performance-critical cases like this problem, replacing Segment[] or PriorityQueue<int[]> sorted via lambda comparators with a custom radix sort on 4 flat int[] avoids comparisons altogether, works directly on raw bits, and accesses memory sequentially. This results in branchless, linear-time sorting with excellent cache usage and significantly lower overhead—often 3–5× faster than Arrays.sort. Valhalla aims to bring value class, value record to Java, allowing objects without identity and header overhead. This would enable Rust-like performance for dense data structures. So, after working for over ten years, when can Valhalla be previewed??????(considering the poor Vector api incubated for over ten times lol).

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

How to prove K? That there exists an optimal path passing through x, y, where x, y are maximal coordinates such that gcd(a,x) = 1 and gcd(b,y) = 1.

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

    (I misread, so ignore, sorry) the path forms a sort of an reversed L(goes right and then down)

    I am going to part from the fact that gcd(x,a) = 1 and gcd(y,b) = 1, and that the lower bound is

    $$$(x - 1) + (y - 1) + \sum_{i=1}^{x} gcd(i, a) + \sum_{i=1}^{y} gcd(i, b)$$$

    Then the cost of the path (goes right and then down) is

    going from $$$(1, 1)$$$ to $$$(1, y)$$$ costs $$$\sum_{i=1}^{y} gcd(1,a)+ gcd(i, b)$$$, and

    $$$\sum_{i=1}^{y} gcd(1,a)+ gcd(i, b) = \sum_{i=1}^{y} 1 + gcd(i, b) = y + \sum_{i=1}^{y} gcd(i, b)$$$

    and going from $$$(1, y)$$$ to $$$(x, y)$$$ costs $$$\sum_{i=2}^{x} gcd(i, a) + gcd(y, b)$$$, and recall that $$$gcd(y, b) = 1$$$, so we have

    $$$\sum_{i=2}^{x} gcd(i, a) + gcd(y, b) = \sum_{i=2}^{x} gcd(i, a) + 1 = -1 -1 + x \sum_{i=1}^{x} gcd(i, a)$$$

    So the cost along all the path can be expressed as

    $$$(x - 1) + (y - 1) + \sum_{i=1}^{x} gcd(i, a) + \sum_{i=1}^{y} gcd(i, b)$$$

    Which is the lower bound, hence it is optimal

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

    Let's look at "border" $$$(n, y) - (x, y) - (x, n)$$$. Any path from $$$(1, 1)$$$ to $$$(n, n)$$$ crosses it.

    WLOG, let's say that the path crosses the border at cell $$$(x, y')$$$ where $$$y \le y' \le n$$$.

    Let's find the minimum path from $$$(1, 1)$$$ to $$$(x, y')$$$. It's easy to see that we can go from $$$(1, 1)$$$ to $$$(x, 1)$$$ and then to $$$(x, y')$$$ since $$$\gcd(x, a) = 1$$$.

    So, the path $$$(1, 1) - (x, y')$$$ goes through cell $$$(x, y)$$$ for any $$$(x, y')$$$.

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

Problem D: i need another editorial or explaination

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

Proving the optimality of the proposed solution for L was not a very easy task...