Codeforces и Polygon могут быть недоступны в период с 6 декабря, 22:00 (МСК) по 7 декабря, 00:00 (МСК) в связи с проведением технических работ. ×

How difficult is this problem?

Правка en1, от shiny_shine, 2024-12-03 13:05:40

Well, codeforcers, it's quite a while since I visited here last time.

If you read this blog, you might know that, a few days ago, NOIP 2024 took place. On Luogu, the difficulties of the four problems are defined as Blue, Green, Purple and Purple. However, when I saw that problem A is blue, I became confused and couldn't understand why it's blue. The forum of this problem in Luogu is CHAOTIC. What I mean is, there are people consider this problem as a problem even a newbie (yes, codeforces newbie) can solve without difficulty, while others say this problem has a difficulty similar to problems in Provincial Team Selection. I'd like to ask you, how difficult is this problem? Here comes the statement:

An integer $$$n$$$ ($$$1\le n\le 10^5$$$) and four 01-strings with a length of $$$n$$$ are given, I will call them $$$a,b,c,d$$$ below.

Now, you want to let string $$$a$$$ and $$$b$$$ be as similar as possible. So, you can perform the following operations:

  • Operation $$$1$$$: choose an integer $$$i$$$ ($$$1\le i< n$$$), which satisfies $$$c_i=c_{i+1}=1$$$, then swap $$$a_i$$$ and $$$a_{i+1}$$$.
  • Operation $$$2$$$: choose an integer $$$i$$$ ($$$1\le i< n$$$), which satisfies $$$d_i=d_{i+1}=1$$$, then swap $$$b_i$$$ and $$$b_{i+1}$$$.

After performing the operations above for arbitrary times, possibly $$$0$$$ times, print the following value:

$$$ \max \sum_{i=1}^n [a_i=b_i] $$$

And here's my code which is able to pass all the samples Luogu given:

Code

Please write how difficult do you think of this problem in comment, and a Codeforces difficulty value if you can. Thanks!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский shiny_shine 2024-12-03 13:05:40 3335 Initial revision (published)