Блог пользователя wakanda-forever

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

Hello, Codeforces!

I am very excited to invite you to our contest Codeforces Round 1059 (Div. 3), which starts on Oct/17/2025 17:35 (Moscow time). You will be given $$$2$$$ hours and $$$15$$$ minutes to solve $$$8$$$ problems.

The problems were authored and prepared by wakanda-forever, wuhudsm, tridipta2806 and frostcat.

Note that at least one of the problems will be interactive. So if you are unfamiliar with them, please read the guide for interactive problems before the contest.

The round will be hosted by the rules of educational rounds (extended ICPC). Thus, all solutions will be judged on preliminary tests during the round, and after the round, there will be a 12-hour phase of open hacks. After the open hack phase, all accepted solutions will be rejudged on successful hacks. Also, note that there is no score distribution — rank will be determined by the number of problems solved, followed by penalty; wrong submissions will incur the usual penalty of 10 minutes, following the rules of educational rounds.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by the link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

We would like to thank:

I wish you the best of luck, and I hope you enjoy the problems!

UPD: Editorial

Полный текст и комментарии »

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

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

2162A - Beautiful Average

Idea: wakanda-forever Preparation: wakanda-forever

Solution
Implementation

2162B - Beautiful String

Idea: wakanda-forever Preparation: tridipta2806

Solution
Implementation

2162C - Beautiful XOR

Idea: wakanda-forever Preparation: wakanda-forever

Solution
Implementation

2162D - Beautiful Permutation

Idea: wakanda-forever Preparation: wakanda-forever

Solution
Implementation

2162E - Beautiful Palindromes

Idea: wuhudsm Preparation: wakanda-forever

Solution
Implementation

2162F - Beautiful Intervals

Idea: frostcat, wuhudsm, wakanda-forever Preparation: wakanda-forever

Solution
Implementation

2162G - Beautiful Tree

Idea: wakanda-forever Preparation: wakanda-forever

Solution
Implementation

2162H - Beautiful Problem

Idea: wuhudsm Preparation: wuhudsm

Spoiler
Solution
Implementation1(wuhudsm)
Implementation2 (Dominater069)

Полный текст и комментарии »

Разбор задач Codeforces Round 1059 (Div. 3)
  • Проголосовать: нравится
  • +69
  • Проголосовать: не нравится

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

Hello Codeforces,

Recently I was trying to make a number theory problem, I haven't framed the entire question yet but the core part goes something like this $$$-$$$ Given an integer $$$a$$$, find an integer $$$b$$$ ($$$ \le a $$$) such that $$$gcd(a,b)$$$ $$$+$$$ $$$lcm(a,b)$$$ is a prime number.

The condition $$$gcd(a,b)$$$ $$$+$$$ $$$lcm(a,b)$$$ is a prime number boils down to $$$gcd(a,b) = 1$$$ and $$$a \cdot b + 1$$$ is a prime where $$$b \le a$$$.

I tried brute-forcing $$$b$$$ by fixing $$$a$$$ and I found that there exists such $$$b$$$ for all $$$1 \le a \le 10^5$$$. However, I am not sure whether there exists such $$$b$$$ for all $$$a$$$. Does anyone have a formal or intuitive proof why this is happening and is there any approach to find $$$b$$$ given $$$a$$$ ?

Полный текст и комментарии »

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

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

Hello everyone. This is my first blog on codeforces.

Coming to the topic, consider the task where you are given an integer $$$n$$$ and you are asked to find the minimum value of $$$k$$$ such that $$$\phi(\phi(\phi...\phi(n)))$$$ $$$= 1$$$ (where $$$\phi$$$ is applied $$$k$$$ times on $$$n$$$ in a nested manner and $$$\phi$$$ is the euler totient function). This task can be solved, but for now let's only focus on finding an upperbound for $$$k$$$.

We have,

$$$ \phi(n) = n \cdot (1-\frac{1}{p_1}) \cdot (1-\frac{1}{p_2}) .... (1-\frac{1}{p_m}) $$$

where $$$n = p_1^{a_1} \cdot p_2^{a_2} \cdot ... p_m^{a_m}$$$ and $$$p_1,p_2...,p_m$$$ are prime factors of $$$n$$$. Proof can be found here.

Now, if $$$n$$$ is even, $$$2$$$ is a prime factor of $$$n$$$ so $$$\phi(n)$$$ $$$\le$$$ $$$\frac{n}{2}$$$ and if $$$n$$$ is odd and $$$n \gt 1$$$, $$$\phi(n) \lt n$$$ and $$$\phi(n)$$$ is even. So we can safely say that $$$\phi(\phi(n)) \le \frac{n}{2}$$$ for all $$$n \gt 1$$$. Repeating this process, it is obvious that after applying $$$\phi$$$ for $$$2 \cdot \lceil \log_2(n) \rceil$$$ times on $$$n$$$, we have $$$\phi(\phi(\phi...\phi(n)))$$$ $$$= 1$$$. So we have $$$k \le 2 \cdot \lceil \log_2(n) \rceil$$$.

We can find an even tighter bound using the fact that $$$\phi(n)$$$ is even for all $$$n \ge 3$$$. So for any $$$n \ge 3$$$, $$$\phi(n)$$$ is even and $$$\phi(\phi(n)) \le \frac{n}{2}$$$, $$$\phi(\phi(\phi(n))) \le \frac{n}{4}$$$, $$$\phi(\phi(\phi(\phi(n)))) \le \frac{n}{8}$$$ and so on. Thus after applying $$$\phi$$$ for $$$\lceil \log_2(n) \rceil$$$ times on $$$n$$$, we have $$$\phi(\phi(\phi...\phi(n)))$$$ $$$= 1$$$. So we have $$$k \le \lceil \log_2(n) \rceil$$$.

I hope atleast someone finds this interesting.

Полный текст и комментарии »

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