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

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

Hello, Codeforces!

A wonderful summer holiday! After College Entrance Examination, we are extremely delighted to invite you to our second round, CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!), which will be held on 31.07.2022 17:05 (Московское время). Note the unusual start time of the round.You are given 8 problems and 2.5 hours to solve them.

All problems were written and prepared by Cirno_9baka, CoupDeGrace, Sugar_fan, ODT, Yakumo_Ran, farmerj, MagicalFlower, izlyforever, kuangbin, mejiamejia, ugly2333 and me.

Task statements and editorials will also be available in Chinese (Simplified) and Chinese (Traditional) after the contest.

We are sincerely thankful for the help provided by:

This is our second round! Great efforts have been put in during the past year. We are sincerely looking forward to your participation and we hope everyone will enjoy it. Besides, this round is sponsored, which indicates that everyone has an opportunity to get the prize!

Good luck!

UPD1: Here is the score distribution:

500-750-1250-1750-2000-2750-3500-(2250+2750)

UPD2:Tutorial is available.

UPD3: Simplified Chinese tutorial is available.

UPD4: Traditional Chinese tutorial is available.

UPD5: Congratulations to the winners

  1. tourist
  2. jiangly
  3. ksun48
  4. heuristica
  5. OddImage
  6. maroonrk
  7. cnnfls_csy
  8. he_____hezhou
  9. 353cerega
  10. WYZFL
  11. ecnerwala

UPD6: Simplified Chinese statement is available.(please download it and open it with edge)



And here is the information from our title sponsor:

Hello, Codeforces!

We, the TON Foundation team, are pleased to support CodeTON Round 2.

The Open Network (TON) is a fully decentralized layer-1 blockchain designed to onboard billions of users to Web3.

Since July, we have been supporting Codeforces as a title sponsor. This round is another way for us to contribute to the development of the community.

The winners of CodeTON Round 2 will receive valuable prizes.

The first 1,023 participants will receive prizes in TON cryptocurrency:

  • 1st place: 1,024 TON
  • 2–3 places: 512 TON each
  • 4–7 places: 256 TON each
  • 8–15 places: 128 TON each
  • 512–1,023 places: 2 TON each

We wish you good luck at CodeTON Round 2 and hope you enjoy the contest!

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

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

Good luck for everyone!!!

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

cooooooool

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

I hope it is not Mathforces again!

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

I am SUPER excited for this round!!!!!!!!!

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

please no math

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

Math Round!!

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

Best of luck!

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

So many nice people in the helper list, this competition will be great.

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

the previous contest of AquaMoon is too hard..hope this round can be a normal round.

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

Since Yakumo_Ran is (again) a problemsetter, will there be Touhou statements?

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

As a tester, good luck to everyone!

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

Good luck!

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

hope this round will be interesting

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

Yay codeton

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

4 weeks ago

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

As a tester, I think some of the problems are very interesting.

Hope all of you will enjoy it!

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

Super data structures round?

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

Is AquaMoon a girl?

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

My glad to be a tester again. Thanks to all of the authors!

This round will be very interesting.

Wish everyone good luck!

(The statements are short and pretests are strong and give me contribution XD)

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

Why is spaghetti.code shown two times in the registrants page with a red highlighted number?

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

What's the prize distribution?

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

Cute AquaMoon's cute round with cute problems!
Hope everyone enjoy it :)

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

Can't help but notice Aquamoon trying too hard to be cute in every comment and blog-post.

No offence o(*^w^*)o (●'◡'●) ヾ(≧▽≦*)o (❁´◡`❁)...

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

I hope it is Mathforces! 0w0

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

so many people!

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

I'm too curious to see your face!

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

WOW!!

So many testers in this round XD

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

AquaMoon orz ❤❤

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

Are u really a cute girl? Don't dig traps for me. ;-;

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

Someone encourage me to participate please I only lose my rate *_*

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

I hope it will be a good round.

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

We hope you will enjoy this round >_<

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

I think it is gonna be a very creative and unique round. Hope I can reach BLUE thru it though a bit worried...

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

Note the unusual timing ...

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

"after college entrance examination".

You mean gaokao in China? In India we have JEE.

Did all the authors get into tsinghua university?

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

Chinese editorial! That's great!

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

Good luck and have fun!!

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

My nightmare of Round #732... Now the problemsetters come back again!

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

Good luck! but I am not skilled in math problems :(

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

As a tester,wish you good luck and enjoy the contest!

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

Is this contest rated for everyone?

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

Really enjoyed Round 732 <3

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

Hurray we have traditional Chinese statements and editorial!!! I am a HongKonger (not shown in my profile though) and I'd love to see that!

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

where is the score distribution ?

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

Chinese statements! Cool!

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

Good luck for everyone XD

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

Everyone should have a dream, and I hope I can reach 1400 points through this round.

»
4 года назад, скрыть # |
 
Проголосовать: нравится -16 Проголосовать: не нравится
Fun fact
»
4 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

what is ton

»
4 года назад, скрыть # |
 
Проголосовать: нравится +57 Проголосовать: не нравится
Codeforces users when they see a problemsetter who is actually a girl:
»
4 года назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

Why was I marked as a tester of this round? I haven't solve it. Will Can I take part in this round?

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

Hope it will not be mathforces again

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

CUTEFORCES

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

Good luck to myself and good luck to everyone in the rankings!

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

I wish I could get rank 1 in this contest and defeat tourist too and impress AquaMoon

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

what is div1 +div 2??

i mean what will be the difficulty of questions

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

8 prblms in 2.5 hrs . Hmm seems like Div3 level i guess ??

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

Good luck

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

I hope there is not too large gap of difficulty between any adjacent problems.

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

When will the scoring distribution be announced?

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

If somebody won't take their prizes, will it pass to the next ones?

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

I got a feeling that the problemset is bound to be nice, given the grand problemsetter & tester team.

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

Hoping for a balance round!!

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

Hope I will reach CM after this round

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

Good Luck EveryOne!

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

So will the score distribution be announced?

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

Second "note the unusual start time" comment.

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

I'm so happy to be able to compete with the big boys again!

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

Finally today the Great Battle between the top 3

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

giving a CF rated contest after almost 3 months . lets relive those days again

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

dang it, I think tourist will be dethroned today

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

Who the fuck wrote problem D's statement?

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

02:29:15, wow!

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

How to solve $$$E$$$?

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

Tourist with the CLUTCH SOLVE to beat Jiangly!!!!

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

Hints for problem D?

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

Tourist nailed it at the last minute and came on top! What a competition!

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

I tried D for 2 hrs and was not able to solve it

And tourist managed to read, think, code and submit it in just 3 mins !!!!!!

How???

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

tourist's last minute submission. Damnnnn...

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

When I thought that jiangly will finally reach top 1:

Then this happened:

dramatic.

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

nice round, but disgusting problem D :(

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

Why is TL in E so unnecessarily strict? I have $$$O(n*(n+m))$$$ solution which does not cross TL, but according to the constraints, it should pass easily.

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

1 min before the end of the contest: Jiangly will beat tourist! After the contest: what? tourist solved G at 02:29:15?

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

wowww..! tourist's last minute clutch!!

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

It's dramatic that tourist overtook jiangly 1min before the contest ends.

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

Thanks, OEIS!

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

F is much too weird. Maybe it's better to set $$$n\le 1000$$$ for those who doesn't know the conclusion?

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

Problem E can __int128 hold all variables?

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

Whoever came up with problem D is an artist. Best problem of this year

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

Fight between tourist and jiangly is always legendary and dramatic for 1st position !

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

I live to see Tourist vs Jiangly.

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

Sorry, I hate this round very much.

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

In G, I reduced it to the following problem:

Given arrays $$$\left\lbrace a_i\right\rbrace_{i\in\lbrace 1,2,\ldots,n\rbrace}$$$ and $$$\left\lbrace b_i\right\rbrace_{i\in\lbrace 1,2,\ldots,m\rbrace}$$$, find all positions $$$j$$$ such that the array $$$c=a[j{.}{.}j+m-1]$$$ is equal to or greater by $$$1$$$ than $$$b$$$ in every position: that is, for every $$$j\in\lbrace 1,2,\ldots,m\rbrace$$$ $$$c_j=b_j$$$ or $$$c_j=b_j+1$$$. Recall that if we remove the $$$+1$$$ possibility (that is, $$$c_j$$$ should be equal to $$$b_j$$$ for all $$$j$$$) then this is simply a substring search task that can be solved using KMP.

Any ideas for "weak substring" problem?

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

    Let's split the numbers that appear in a in b by numbers that appear a lot and numbers that don't appear a lot. Try to match a number x in b with numbers x or x+1 in a.

    For numbers that appear a lot use fast convolution, for numbers that don't appear a lot use brute force. This ends up in $$$O(N\sqrt{NlogN})$$$ if you split numbers at frequency around $$$O(\sqrt{NlogN})$$$ I think.

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

    Using Fast Fourier transform we can calculate $$$\sum_{i = 0}^{m - 1} (a_{i + j} - b_i)^2(a_{i + j} - b_i - 1)^2$$$ for every $$$j \in \{1, 2, \ldots ,n - m \}$$$ in $$$O(nlog n)$$$ time. Each $$$0$$$ in this sequence corresponds to "weak substring" starting from position $$$j$$$.

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

    Another way to do it is to do string matching with wildcards twice, on even and odd values.

    For the first matching on even values, we mark all odd numbers on $$$a$$$ as wildcards. For all odd numbers in $$$b$$$, we add $$$1$$$ to it. Then this becomes the usual string matching with wildcards.

    The second matching is done similarly. We just have to check that the substrings match in both cases.

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

Can't believe I guessed the second part of answer for D based on the test samples and some data I collected for the first part.....still no clue why it works.....but somehow I have confidence that it would pass the system test....

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

Even though I sit for almost 2 hours thinking about D and I feel totally useless, I have now read the required observation and it's just beautiful. I wouldn't mind failing miserably every time if the problems are like this one. Thanks to the author.

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

    I got it slightly late :(.

    We case on B. Each element $$$k$$$ of b falls into 4 types, depending on the two decisions $$$b[k] = k$$$, and whether there exists i!=k such that $$$b[i] = k$$$.

    Let's say there are i elements such that b[i] = i, and j of those appear again in the array. The total number of such arrays is the product of:

    $$$\binom{n}{j}$$$ -- number of ways to choose elements such that b[i] = i

    $$$\binom{i}{j}$$$ -- number of ways to choose elements (b[i] = i) that appear again

    $$$\binom{n - i}{n - i - j}$$$ -- number of ways to choose elements (b[i] != i) that appear again

    $$$j \cdot (n - i + 1)!$$$ -- number of ways to set the values for the n-i elements that do not equal themselves (This is non-obvious, but try creating a recurrence relation)

    Then for each of these b arrays, there are $$$(n-i)^{i-j} (n-1)^j$$$ a arrays that correspond to each.

    Summing over all $$$i,j$$$ gives the answer.

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

      Oh wow, that's completely inverted line of thinking to what I was thinking was much more natural. I thought to characterize for each a how many bs we can get and sum over that (which actually looked quite viable, but didn't manage to do so)

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

        I spent most of my time doing that, but when I switched perspectives it worked really well (but not fast enough :( ).

        I couldn't really come up with any ideas to combat the fact that things in a can have high 'indegree'. What were you coming up with?

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

          In this problem we are dealing with functional graphs. If we focus on one connected component then it is almost a tree and the problem is easily solvable on trees by some dynamic programming. We would like to maintain two numbers for a tree that we assume has some outgoing edge of the root. Namely, how many final configurations we can get depending on whether the root will make a move or not. If these pairs for our subtrees are

          $$$(a_1, b_1), \ldots, (a_k, b_k)$$$

          then if we denote the pair for the root as

          $$$(A, B)$$$

          then

          $$$A = \sum_{i=1}^{k} i \cdot \sum_{|B|=i} \prod_{j \in B} b_j \prod_{j \not\in B} a_j$$$

          and

          $$$B = A + a_1 \cdot \ldots a_k$$$

          and this is computable through some dps (possibly in $n^3$ as we can use preprocessing)

          The idea would be to improve this approach to handle the additional edge somehow and combine various connected components in a knapsack-like fashion with some Newton's symbols along the way.

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

          I guess that's what I was doing, looks like I'm the only stupid guy with hundred lines of weird dps instead of 5 lines of formulas (I still don't understand your solution). 166399131

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

            Ok, the main idea is that for each array $$$b$$$, we want to count how many $$$a$$$ will work.

            If we have $$$b[k] = j$$$ for $$$k \neq j$$$ that forces $$$a[j] = k$$$ (because $$$j$$$ must have invaded $$$k$$$). This means that if we have $$$n - i$$$ elements of $$$b$$$ that are not fixed points (and $$$i$$$ fixed points), then $$$n - i$$$ of the values of $$$a$$$ are fixed.

            Now for the indices $$$ind$$$ for which we do not know $$$a[ind]$$$ that were invaded, they can have any of the $$$n - 1$$$ possible values, as we can just assume they are placed later in the permutation than the thing that invaded them, and everything will be consistent. For the indices that survived, they can go anywhere that does not have $$$b[k] = k$$$ because we can assume their invasion was overridden later.

            Basically any $$$a$$$ that does not cause simple contradiction is possible, because we can just place certain elements at the beginning or end of the permutation.

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

(I'm not good at English so I used DeepL translation. So if there is any unnatural English, I am sorry.)
This image is a Google search result during Coding Phase.
They (the uploaders of the top 3 videos) seem to upload their solutions to YouTube during the contest, isn't this a violation of the terms and conditions?
(if I misunderstand and this is not a violation, sorry.)
PS: I took my friend's advice and improved the grammar of this comment.
https://twitter.com/kenkenokkuu/status/1553781614941175808

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

How to solve H1?

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

E is cool, D is too unnatural to be a good problem, but it's decent, B and C both very boring problems with standard greedy, A is fine

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

How do you solve problem A efficiently ? I tried recursive memoized approach, got TLE.

My Submission

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

    You just check if the last m-1 characters in string a is the same as the last m-1 characters in string b, where m is size of b. Then just check if the first character in b exists somewhere in string a before the last m-1 characters. If both are good, then its true.

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

    Notice that you can't change last m-1 symbols of string a. So if last m-1 symbols of string a are not equal to the last m-1 symbols of string b, then the answer is "No". Now we should check b[0]. Consider two cases:

    1) b[0] == '0'. If a[0:n-m) contains '0', then we just apply (n-m) min operations to string a to get '0'. We can't do that ONLY if string a[0:n-m) consists of n-m '1' symbols (as min(1,1) = 1; max(1,1) = 1).

    2) b[0] == '1'. If a[0:n-m) contains '1', then we just apply (n-m) max operations to string a to get '1'. We can't do that ONLY if string a[0:n-m) consists of n-m '0' symbols (as min(0,0) = 0; max(0,0) = 0).

    We can check these conditions in O(n).

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

Why there wasn't any announcement that the statement for E changed? I was debugging for an hour just because of the third example. :(

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

Finished E after contest (at least I think finished)
Dropping out of violet because of the wrong submission for A...

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

How to solve E?

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

For the guys who solved D. How did you come up with the prefix sum observation? Had you solved similar problems before?

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

    I thought about prefix sum as well but my final solution does not have it

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

    I was looking for an invariant. I didn't find a prefix sum observation (although it is the same after all).

    First idea was sum of values... though this stays also the same for the fake-row. So it was of no use.

    Next idea was alternating sum. That was strange and I couldn't get any information out of that.

    Third idea I imagined the values as stones. Each operation is moving one stone to the left and another one to the right. Now the stones are worth some points. I needed the pointvalue to stay constant after an operation. So I decided, moving a stone to the left removes one point. Moving it to the right adds one point. So every stone contributes as many points as its position. Doing the normal operation keeps the total score constant. Doing the fake operation adds one point. So $$$\sum_i i \cdot c_t[i]$$$ was my invariant which I could directly use to find the fake row and calculate the number of operations on it.

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

    It's a common technique. When you have operation like adding or subtracting, see what's the effect on the prefix sum/difference array.

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

    Its common to take prefix/suffix sums when we consider operations on adjacent indices. Another recent example problem: link

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

can anybody tell me what is wrong in my code for B ? i spent much time to this due to which i solved C very late and had only 20 min for D https://codeforces.me/contest/1704/submission/166395252

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

    Your approach fixes $$$v$$$ to be equal to the first value of $$$a_i$$$ after a change (or at the start), but this is not necessarily optimal. For example, if your $$$k = 3$$$, and the first two food piles have values $$$4$$$ and $$$10$$$, then you should actually use $$$v = 7$$$ to eat both without changing.

    Instead of actually choosing the value of $$$v$$$, you should instead keep track of the maximum/minimum so far. As long as the difference is $$$\leq 2k$$$, then there exists a value of $$$v$$$ that can handle all those elements. Once the difference becomes $$$ \gt 2k$$$, a change is required and you can reset maximum/minimum.

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

For E how actually to take mod without influencing the final answer. I suppose taking mod before calculating maximum will produce WA, so there is no way to take mod before output (but then the answer can reach 2^300 somehow)... Got stuck for the whole contest orz.

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

.

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

    .

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

      Could you or someone else please point me to an official statement regarding the usage of pretests during the round? I'm not trying argue with you, I'm genuinely curious about this. Obviously, pretests reduce the pressure on the system, but also, they are a nice tool to make the whole experience more exciting (like freezing in ICPC). Another thing is that pretests make you a better coder. Yeah, it sucks when you get FST, but the danger of it makes you more careful both when solving and coding. Lastly, pretests make the whole hacking process possible.

      All I found is this from the contest rules:

      It is known that pretests do not check solution completely. Usually there are 2-10 pretests, and the fact that the solution passed pretests says only that it is quite reasonable. Typically pretests not contain the maximal tests, corner cases, etc.

      And also this from the contest preparation rules (from this post):

      In general, pretests should include: a test with maximum size of input (e.g. maximum n), a test against integer overflow, a few random small tests. All corner cases that are easy to miss. If you deliberately don’t include some corner case, talk to the coordinator about this.

      These rules also say, that wrong solutions should be prepared for integer overflow and for case work. These solutions should also fail pretests, which kind of contradicts the first citation:)

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

While some might complain that the contest was too hard (I think it's fine for a Div1+2 though), I don't think anyone can complain about the quality of the sample input/output. Very robust set of input/outputs such that a matching output is unlikely to be a coincidence. You still need to consider edge cases by yourself, of course, but I really appreciate not having to deal with the paranoia that the general idea is wrong even when the sample output matches.

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

Me:

  • Reads statement of D.
  • Immediately takes prefix sums.
  • Notices operation $$$2$$$ is just operation $$$1$$$ with extra subtraction.
  • "Hmm...how can I possibly tell these two operations apart?"

FML

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

does eng Tutorial of G,H gonna be available later or only Chinese are given?

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

Wow! Now tourist has a one kiloTON of crypto!

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

Weak tests in E, why are solutions that just simulated using big integers passing?

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

As a tester, I'm sorry for not realizing that the main test for E is weak :(

I've submitted an uphack just now.

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

What was the point of such strict time limit in E? (one second for seemingly intended O(n^2), n = 10000)

My python solution doesn't pass, c++ — easy.

I understand when it is intended to cut down inefficient c++ solutions but was there really anything like that here?

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

To not keep you waiting, the ratings are updated preliminarily. Tomorrow I will remove cheaters and update the ratings again!

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

    It's very sad when attempts are ignored because of random coincidences. I am not a cheater, but I have no evidence that I did not cheat. I just love solving contests, I don't even have a suggestion on how to fix the random match situation. Just sad :(

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

Rating: 1900

Hope removing cheaters will not reduce my rating :laugh:

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

editorial for Traditional Chinese, I will ask aquamoon to update it to the announcement tomorrow. https://hackmd.io/nSTr3Ky4SyWNyvatJOXefw?view

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

It is my regret that I did not attend

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

D is really nice, but I wonder what's an issue with using just $$$n=2$$$. The conditions seem pretty contrived to me.

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

This round changed my impression to chinese round.
If F is not an oeis problem or make a subtask for n^2, it will be better.

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

How can I recieve the prize in TON?

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

So how could we receive the prize sponsored by TON?

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

What a great round!

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

I must say that problem D was terrific. Thanks for the round.

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

Could someone explain to me the intuition behind mx - mn > 2 * x in B?

The way I solved the problem is that I checked if the intervals of [a_i - x, a_i + x] had overlap. If yes, update interval to intersection, else use new interval of current a_i and increment counter. This passed.

However, everyone seemed to solve the problem using the inequality mx - mn > 2 * x. I understand how this comes from manipulating abs(v - a_i) <= x. However, I do not understand it intuitively. Like, how does that work practically? How is double the value of x and the difference between max(a_i) and min(a_i) related in such a way to solve this problem? Like beyond the maths of it and rather intuitively.

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

    It is actually pretty much the same thing you did. Instead of looking at "how long will my $$$2x$$$-long intervals ('intervals of [a_i - x, a_i + x]' as you call them) overlap" this looks at "How long can I place new points, such that a $$$2x$$$ Interval still can overlap all of them".

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

Attention!

Your solution 166365821 for the problem 1704C significantly coincides with solutions ruimina/166361635, xxh1999/166365112, siganai/166365821, shobonvip/166366942, OpKos/166367243, bharat007/166373462, Aksnov/166374356. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.me/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.

I received these messages, but I did not cheated. I think it is a false detection of the fast input code. Fast input code is published on https://gist.github.com/ShubhamKJha/f16f5eb7e6da41da5f4b95d004b55d6e

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

    I received these messages too. And I agree with you.

    The logic of this problem is very simple. Our logic in the main function is similar, but there are still differences in our code. Fastio is commonly used in Python for fast reading and writing. I use it in every problem.

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

    I'm on that list, and received the same message. I agree with you too.

    If I use Python/Pypy without FastIO, I'll often get TLE. Once I had failed system tests with TLE due to I/O slowness, and since then I've always used it.

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

    I received the same message, the only similarities i can see between our solutions is that we all use FastIO for Python, which was clearly published before the competition. I don't know if it triggers those false alarms regularly, but maybe FastIO should be whitelisted from the cheat detection system.

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

    I received these messages too. I agree with you guys. I've been using FastIO for a long time, so do other people I think. It seems the main function part of our solutions are significantly different.

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

Thanks for the contributors of this contest. I become an Expert!

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

Why is the Simplified Chinese statement machine translated?

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

    Why do you think so? This is manually translated by me and kuangbin, aquamoon, maybe the quality is not very high, but we spent a lot of time.If your message is said without any evidence, it will only lead to more and more Chinese round authors giving up on making Chinese statement, because it is a thankless task.

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

      I am very sorry if my comment is offensive,but some part of that is quite weird.

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

        Can you give some examples? Let's improve it. (I think we all translate very seriously)

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

          Like the fourth line in "Input" of D,the sentence does not make sense.

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

            This question was not translated by me, but I looked at the place you mentioned, and there is indeed a problem. We will review all statements and then update it, it may take some time, thank you for your feedback.

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

            I reviewed the entire statement with aquamoon and temporarily updated a version. Sorry for the late update, because I'm not a student, I have work to do, and my sister aquamoon has been busy lately. I'm asking izlyforever and CoupDeGrace to review it again, we should have another update over the weekend. Then, when I reviewed it, I found that the quality of the translation was really poor, no wonder it was suspected of being a machine translation, and I am very sorry for that. If you find any problems, please give feedback in time, and we will change it until almost everyone is satisfied.(UPD: We updated the version reviewed by izlyforever and CoupDeGrace.)

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

Hi,

Out of curiosity, when will the problem ratings for these problems be updated in the problemset? Some of the more recent contests have their problem ratings assigned already (like the Division 3 round and the Educational round) but this set is missing them.

Thanks!

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

Very nice problems, thanks!

It seems that the statement in Chinese has broken. Would you mind updating the statements, if possible? Or if it's just my own problems, could you show me how to operate it appropriately?

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

    Nope, no damage, I tried it. Please try the following steps: 1. Download it. 2. Check whether the extension name of the file is mhtml (note that if the operating system is set to hide the known extension name, please set it to display the known extension name) 3. Open with edge.