-firefly-'s blog

By -firefly-, 3 months ago, In English

Hello, Codeforces!

After years of hard work, we are euphoric to invite you to participate in Codeforces Round 1077 (Div. 1) and Codeforces Round 1077 (Div. 2), which will be held at 29.01.2026 17:35 (Московское время). For both divisions, you will be given $$$7$$$ problems and $$$3$$$ hours to solve them. For at least one of the divisions, one of the problems will be divided into two subtasks.

The problems are invented and prepared by Bronya_H, Error_Yuan, StarSilk, Tobo, __baozii__ and me.

We would like to thank:

The score distribution is below.

Div. 1: $$$750 - 1250 - 1750 - 2000 - 2250 - (2000 + 3500) - 3000$$$.

Div. 2: $$$500 - 1000 - 1500 - 2000 - 2500 - 2750 - 3000$$$.

We sincerely hope you can enjoy the problems. Good luck and see you on the field !

Bonus

UPD1: The hacks are disabled for problems A-D in Div 2, and for problems A-B in Div 1. We have final tests consisting of pretests and hacks for all problems.

UPD2: Editorial

Full text and comments »

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

By -firefly-, history, 9 months ago, In English

I hope you all enjoyed the contest!

Rating Predictions
Rate the contest!

2131A - Lever

Idea: -firefly-
Preparation: -firefly-
Analysis: temporary1

Hint
Solution
Code (Python)
Rate the problem!

2131B - Alternating Series

Idea: -firefly-
Preparation: -firefly-
Analysis: reirugan

Hint 1
Hint 2
Solution
Code (Python)
Rate the problem!

2131C - Make it Equal

Idea: Tobo
Preparation: Tobo, -firefly-, Friedrich
Analysis: Tobo

Hint
Solution
Code (Python)
Rate the problem!

2131D - Arboris Contractio

Idea: -firefly-
Preparation: -firefly-
Analysis: __baozii__

Hint 1
Hint 2
Solution
Code (Python)
Rate the problem!

2131E - Adjacent XOR

Idea: -firefly-
Preparation: -firefly-
Analysis: __baozii__

Solution
Code (Python)
Rate the problem!

2131F - Unjust Binary Life

Idea: efishel, __baozii__
Preparation: -firefly-
Analysis: temporary1, reirugan

Hint 1
Hint 2
Solution
Code (C++)
Rate the problem!

2131G - Wafu!

Idea: -firefly-
Preparation: -firefly-
Analysis: __baozii__

Hint 1
Hint 2
Hint 3
Solution
Code (Python)
Rate the problem!

2131H - Sea, You & copriMe

Idea: __baozii__, -firefly-
Preparation: -firefly-
Analysis: -firefly-

Hint 1
Step 1
Hint 2
Step 2
Code (C++)
Rate the problem!

Full text and comments »

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

By -firefly-, 11 months ago, In English

Hello, Codeforces!

We are euphoric to invite you to Soy Cup #2: Vivian, which will take place on 01.06.2025 15:05 (Московское время).

You will have $$$5$$$ hours to solve $$$13$$$ problems, including at least one interactive problem.

This is a team contest following ACM/ICPC rules, with teams of up to $$$3$$$ members. The penalty for an incorrect submission is 20 minutes.

The standings will be frozen for the last 60 minutes of the contest. The final results and editorial will be streamed live on Bilibili on June 2, 2025, at 06:00 UTC.

All problems are created and prepared by me.

We would like to thank:

  1. MikeMirzayanov for creating the fantastic CodeForces and Polygon platform.
  2. torif for sponsoring the round.
  3. SATSKY_2025target_LGM, Tobo, AkaiLemon, Maxduan, SudoXue, rewhile, and baka_killer_uuz for testing the round and giving useful feedback.
  4. macaquedev for refining statements.
  5. The groupmates from bookcat Fan Club and cry's basement for allowing me to postpone my crossdressing to March infinity.
  6. pop and Beaten for preparing and urging my cosplay.
  7. You for participating in the round!

Registration

Because the round is not public as we want to do scrollboard, you need to fill this sheet to register the round. If you live in China and have a WeChat account, you can participate officially to have a chance of getting prizes. As an alternate, you can also fill this sheet which is in Chinese to participate officially.

Prizes

Our awards for official teams are divided into two categories:

First to Solve Awards

A prize will be awarded to the first team that solves each problem. The 13 problems are grouped into four tiers based on their factual difficulty (first by accepted teams, then by total penalties):

  • Tier 1 (3 problems): 20 RMB for the first solve on each of these problems.
  • Tier 2 (3 problems): 10 RMB for the first solve on each of these problems.
  • Tier 3 (3 problems): 5 RMB for the first solve on each of these problems.
  • Tier 4 (4 problems): 2 RMB for the first solve on each of these problems.

Final Ranking Awards

These awards are based on the final leaderboard standings.

  • Top-3: The champion, runner-up, and 3rd place teams will be awarded 50, 30, and 20 RMB respectively.
  • Gold Award: Top max(6, 10% of eligible teams) will be awarded 10 RMB.
  • Silver Award: The next max(9, 15% of eligible teams) will be awarded 5 RMB.
  • Bronze Award: The next max(12, 20% of eligible teams) will be awarded 2 RMB.

Please Note:

  • A team is eligible if and only if it is official and has a submission during the round.
  • When calculating the percentage of eligible teams, the result is rounded up. For example, if there are 61 eligible teams, the Bronze Award will be awarded to 13 teams.
  • Teams winning a Top-3 award are also considered Gold Award winners but will not receive the monetary prize for both.
  • In addition, all prized teams will also receive plaques as memorials.

Good luck and have fun!

vivian
Vivian from Zenless Zone Zero, after whom our round is named

UPD: All of the registrants are now invited to Soy Cup #2 Warmup, which will start on 31.05.2025 14:05 (Московское время). Please confirm you have access to the warmup contest by then! The problems of the warmup round make no sense and have no relation to the round tomorrow.

UPD2: The registration will be closed by June 1, 2025, at 11:30 UTC. Please register as soon as possible if you'd like to participate.

UPD3: All participants should be notified that you are now accessible to the contest now. If you don't receive the message, please contact me asap.

Full text and comments »

Announcement of Soy Cup #2: Vivian
  • Vote: I like it
  • +106
  • Vote: I do not like it

By -firefly-, history, 18 months ago, In English

Introduction

A classical problem reads:

Count the paths from $$$(0,0)$$$ to $$$(m,n)(n \gt m \gt 0)$$$ that doesn't go through $$$y=x$$$ (the path can touch the line). One can only move up or right by $$$1$$$ in one move.

The problem can also be described as:

Count binary strings that consist of $$$m$$$ zeros and $$$n$$$ ones $$$(n\ge m)$$$, such that in every prefix of the string, the number of zeros doesn't exceed the number of ones.

Consider how to count paths from $$$(0,0)$$$ to $$$(m,n)$$$ without the intersection restriction. To get to $$$(m,n)$$$, we must move up $$$n$$$ times and move right $$$m$$$ times. In other words, we need to permute $$$n$$$ right and $$$m$$$ up, whose quantity is

$$$\displaystyle{\frac{(m+n)!}{m!n!}=\binom{m+n}{m}}$$$

To find the answer, we can try to count the paths that go through $$$y=x$$$, and this is when the reflection principle is utilized. The principle says:

Given point $$$A,B$$$ at the same side of line $$$l$$$, the number of paths from $$$A$$$ to $$$B$$$ that intersect with $$$l$$$ is equal to that of paths from $$$A^\prime$$$ to $$$B$$$, where $$$A^\prime$$$ is the reflection point through $$$l$$$.

To show why it is correct, we should first note that a path from $$$A^\prime$$$ to $$$B$$$ must intersect with $$$y=x$$$. Say at point $$$P$$$ the path first intersect with $$$y=x$$$, we can reflect the path from $$$A^\prime$$$ to $$$P$$$ through $$$l$$$ and get a path from $$$A$$$ to $$$B$$$, and vice versa. This indicates that the intersecting paths from $$$A$$$ to $$$B$$$ and the paths from $$$A^\prime$$$ and $$$B$$$ are one-to-one corresponded, and the quantity of the two are the same.

Back to our problem. Going through $$$y=x$$$ is the same as intersecting with $$$y=x-1$$$ in this case, so $$$(0,0)$$$ can reflected to $$$(1,-1)$$$, and the number of intersecting path is $$$\binom{m+n}{m-1}$$$. Therefore, the answer to the problem is

$$$\boxed{\displaystyle{\binom{m+n}{m}-\binom{m+n}{m-1}=\frac{n-m+1}{n+1}\binom{m+n}{m}}}$$$

In particular, when $$$n=m$$$, the formula becomes

$$$\boxed{\displaystyle{\frac{1}{n+1}\binom{2n}{n}}}$$$

which is the Catalan number.

Note

Examples

26D - Tickets

Tutorial

105390D - String From Another World

Tutorial

2025E - Card Game

Tutorial

Full text and comments »

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