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

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

Xin chào Codeforces (・ω・)ノ

We are pleased to announce the resumption of the Global Rounds. Thanks to XTX Markets for supporting the initiative! In 2024, we will hold 4 such rounds. The series results will take into account the best 3 participations out of 4.

On Apr/06/2024 17:35 (Moscow time) we will host Codeforces Global Round 25.

Codeforces Global Round 25 marks the first round in the 2024 series of Codeforces Global Rounds. These rounds are open and rated for everyone.

The prizes for this round are as follows:

  • The top 30 participants will receive a t-shirt.
  • 20 t-shirts will be randomly distributed among participants ranked between 31 and 500, inclusive.

The prizes for the 4-round series in 2024:

  • In each round, the top-100 participants get points according to the table.
  • A participant's final score will be the sum of the points they earned in their 3 highest-placing rounds.
  • The top 20 participants across the series will receive sweatshirts and placement certificates.

We extend our gratitude to XTX Markets for supporting the global rounds initiative in 2024!

The problems were all marinated and cooked by MofK and Kuroni.

Our sincerest gratitudes go to:

Round Information:

  • Duration: $$$3$$$ hours.
  • Number of problems: $$$9$$$ problems.
  • Score distribution: $$$500 - 1000 - 1500 - 1750 - 2250 - 2750 - 3250 - 3500 - 4000$$$.

A tiny bit of personal note at the end, this is our first round on Codeforces in 3 years, and it feels a bit nostalgic to be back here again :) We eagerly anticipate your participation and let's all make it an awesome contest together!

Blooper

UPD: Added score distribution.

UPD: The round has concluded. Congratulations to the winners!

  1. Geothermal
  2. ecnerwala
  3. Um_nik
  4. maroonrk
  5. EvenImage
  6. Benq
  7. hos.lyric
  8. antontrygubO_o
  9. cmll02
  10. AlternatingCurrent

Tutorial can be found here, and playlist of songs used in the problem statements can be found here.

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

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

GLOBAL ROUND COMEBACK LET'S GOOOO!!1!

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

omg kuroni round

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

As the author of at least 1 problem, hi! (updoot on the right)

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

As a tester, I love this contest. And I hope you will too!
Kuroni senpai orz

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

As a tester, I enjoyed this round and I hope you will too!

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

I pray to God that I can solve C this time.

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

Please marry me

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

    Hi everyone, I have an announcement to make. Ari is no longer my girlfriend.

    We're married now.

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

      Before every contest, I habitually review the previous contests of the authors. It dawned on me that you both frequently collaborated on them. However, after stumbling upon this blog, I found myself scrolling through the comments. I noticed people hailing you as a legendary figure returning after a long absence. This sparked my curiosity about you and make me excited about this upcoming round. It's remarkable to learn that the two of you were not only partners in creating Codeforces rounds but also in life, culminating in marriage. I'm genuinely awestruck. Wishing both of you a lifetime of happiness! As they say, "Happy wife, happy life."

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

As a tester, meow

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

MofKuroni orz let's gooooooooooo

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

As a tester, I hope you guys enjoy this round

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

cuteroni

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

As a tester, I need one more rating point but Kuroni say No.

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

Finally!! Finally it's back!!!

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

As a tester, I can't speak too much, or Kuroni will send two Bocchi plushies to subdue me

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

omg kuroni round vietnam gm orz so cute i love u uwu

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

My waifu Ikuyo Kita is soooooo cute!

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

Omg global round

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

Kita wants to let you know something

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

good luck everyone, hope you all get a higher rank this round!!!

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

As the 🧌 coordinator, I can't participate :(

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

kuroni la ai ?

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

Is it rated?

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

Can somebody share the link to the blogpost that explains the legacy of CF global rounds or could just simply explain abt it.I am a bit curious to know abt it.

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

3 hours 🤢

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

As a tester, i tested

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

How hard are the questions? I mean what div?

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

Is it rated?

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

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

leaving a comment for the culture

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

T made a mistake replacing X(his ex) else it would have been a lot of fun (XXX)

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

Let's go!!! and defeat all the questions. I can't wait to see the green accepted submission!!!!!!!

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

I hope I can solve 3 today !!! :(

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

Is it rating contest?

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

the blooper gif :skull: :eyes_with_spiral: :sob:

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

kuroli came back :((((((

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

let's see how rusty i am

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

I can feel the wa energy

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

found amogus in Problem D. ඞ

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

genuine question, is the song for each problem from author's playlist or it's just random bangers from youtube?

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

You Bad, heat you.

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

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

I took a short break from CP, but i am glad, that i came back for this one. I absolutely liked the problems, especially ones i didn't solve. Looking forward to the editorial to up-solve some.

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

Me spending two hours thinking of C "wait what kind of simulation is needed for this clusterhex?"

Me prepassed C at 2hr: "wtf just greedily sorting?????"

I should catch a break...

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

For problem G, OEIS saves my day!

Spoiler

I'm wondering if H is even easier than D/E or just my simple greedy algo passed the pretests?

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

got 13 WA on B

How to solve it??

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

    I think the solution is just: try swapping with the first cow, and see what score you get, try swapping with the first cow that beats you, see what score you get. Take the maximum of these two. You can get both scores in linear time.

    The reason this should work is: 1) you should never swap with anything later than the first cow that beats you, because then you will lose all your games 2) all the cows before the first one that beats you, you will beat, so if you swap with anything before the first cow that beats you, you might as well swap with the very first one (then you'll get to play the maximum number of matches before you go up against the first one that beats you).

    I don't know though. I have 999 WA on this as well.

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

Geothermal orz, is this your first Div1 win? (assuming no FST)

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

    This was not a div 1 round, it was global round. div 1 + div 2, get it ?

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

      For the top participants (who are in div1), their ranking in a div1 versus their ranking in a div1+div2 will be pretty much identical. Thus, a div1+div2 is functionally a div1 for someone at the top of the leaderboard. They don't need to be categorized separately in this case.

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

        If you knew how codeforces rating system works, you'd know that you're completely wrong.

        Again, this was not a Div 1 round and Geothermal is yet to win his first Div 1 round.

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

          I know how the rating system works, and I know that for div1 participants at the top of the leaderboard (like top $$$100$$$ or smth), it doesn't matter if the contest is a pure div1 with ~$$$1000$$$ at least candidate masters, or if there are also $$$10\,000$$$ more lower rated participants in the contest. Someone rated $$$3200$$$ or similar is expected to place higher than someone rated $$$1800$$$ or lower with probability nearly equal to $$$1$$$, and assuming the $$$3200$$$ places high, they will have placed higher than (almost all if not) all $$$\le 1800$$$ participants, so their participation in the contest has no significant effect on the rating change of the $$$3200$$$ participant.

          If the $$$3200$$$ participant solves no problems, then they will lose more rating in a div1+div2 than they would in a pure div1. But this is not really a realistic situation, so it doesn't matter in practice.

          Technically winning a div1+div2 is more difficult than winning a pure div1, since a div1+div2 has more participants. Also, div1+div2's often might also have more good participants than pure div1's, especially when the rounds have prizes.

          Also, why are you so keen on the technical definition of "div1"? It doesn't actually matter how a word is technically defined, what matters is how the word is used in practice. And in practice div1 participants use the word "div1" to refer to a Codeforces contest which is rated for participants with no rating upper bound. Div1+div2 falls into this category, so it is called a div1 contest.

          If you reply, I probably won't be replying back anymore. I don't want to engage in arguments with people who are overconfident about things they don't understand correctly.

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

    vgtcross orz, can you please share your thought process and how do you make observation and come up with a solution for problem C it will be helpful for other people also.

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

Solved C without proving

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

    How to solve C?

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

      It is obvious that you have to buy tickets in at least p = (k + m — 1) / m days. So, sort a, and take the first $$$p$$$ $$$a_i$$$ to buy. Then you need to decide which day you will buy the least tickets. And I "feel" that it should be the day with max $$$a_i$$$ among those p days, and the index of that day is the smallest as possible (Here is when I can't prove)

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

        "the day with max $$$a_i$$$ among those p days"

        I wrote several cases on paper, and it seems to me, that it doesn't matter, which day to choose for least number of tickets, as long as the multiset of numbers of bought tickets is the same (which is of form $$$x, \dots , x, x - 1, \dots , x - 1$$$).

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

          Glad to hear you say that, as I swear it doesn't work with my random approach :v

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

          i did calculations but i cant prove why the order doesn't matter any idea??

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

            after analyzing the problem, you need to find the minimum sum {v[i] * s[i], 1 <= i <= n} + sum {s[i] * sum {s[j], 1 <= j < i}, 1 <= i <= n} (where v[i] is the initial ticket value and s[i] is how many tickets you buy in day i). the second part of the equation is just sum {s[i] * s[j], 1 <= j < i <= n}, which is equal to ((sum {s[i], 1 <= i <= n}) ^ 2 — sum {s[i] ^ 2}) / 2. But (sum {s[i], 1 <= i <= n}) ^ 2 = k ^ 2, and all you need to now is to minimize the sum {v[i] * s[i], 1 <= i <= n} — sum {s[i] ^ 2 / 2, 1 <= i <= n} = sum {- 1 / 2 * s[i] ^ 2 + v[i] * s[i], 1 <= i <= n}. this is how i proved that the order of the elements doesn't matter. after this, is pretty easy to see why the greedy algorithm works.

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

    Same, and it feels tougher than D and E, possibly even F if my approach is correct.

    Though to be fair, I feel like most people would have guessed the approach to E as well.

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

      What's the proof for E? I guessed two is always possible, but did not want to submit without proof.

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

        No clue at all, I just guessed that if the answer is YES, its always possible by splitting the string into at most 2 parts. I stress tested against a few million small palindromes to convince myself and then submitted.

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

        Disclaimer: A simpler proof may exist.

        We will show that every string falls into (at least) one of the following categories:

        • one substring works (the string is not palindrome)
        • two substrings works (there exists a non-palindromic prefix-suffix partition)
        • no solution exists

        If $$$s$$$ is not a palindrome, one substring works. Now assume $$$s$$$ is palindromic.

        If every character in $$$s$$$ is equal, no solution exists. Now assume $$$s$$$ contains at least two distinct characters.

        Let $$$a = s_1 = s_n$$$, i.e. $$$a$$$ denotes the first (and last) character of $$$s$$$.

        Let $$$b$$$ be the first non-$$$a$$$ character in the string. Now the string must look something like this: a...ab?...?a. The prefix a...ab is not a palindrome. If the suffix ?...?a is not a palindrome, we found a good split. Now assume the suffix is a palindrome.

        Let the position of $$$b$$$ be $$$k$$$. Now we know that $$$s[1, n]$$$ is a palindrome, and $$$s[k+1, n]$$$ is also a palindrome.

        This means that for all $$$1 \le i \le n$$$, $$$s_i = s_{n+1-i}$$$. Also, for all $$$k+1 \le i \le n$$$, $$$s_i = s_{n+k+1-i}$$$.

        Now take any $$$1 \le i \le n-k$$$. We know that $$$s_i = s_{n+1-i}$$$.

        $$$1 \le i \le n-k$$$

        $$$-1 \ge -i \ge k-n$$$

        $$$n+1-1 \ge n+1-i \ge k+1$$$

        $$$n \ge n+1-i \ge k+1$$$

        This means that $$$s_{n+1-i}$$$ is inside the palindrome $$$s[k+1, n]$$$. Thus, $$$s_i = s_{n+1-i} = s_{n+k+1-(n+1-i)} = s_{n+k+1-n-1+i} = s_{k+i}$$$.

        $$$s_i = s_{i+k}$$$ for all $$$1 \le i \le n-k$$$. Thus, the string $$$s$$$ is just $$$s[1, k]$$$ repeated until the end.

        Since the string is a palindrome, it must look like aaabaaabaaabaaabaaa.

        There are a few cases left. Let $$$x$$$ denote the number of $$$a$$$ between every $$$b$$$ ($$$x = 3$$$ in the above string). Let $$$y$$$ denote the number of $$$b$$$ in $$$s$$$ ($$$y = 4$$$ in the above string.)

        If $$$x = 1$$$, the string looks like abababababababa. Any substring of odd length is always a palindrome. Since $$$s$$$ has odd length, a split cannot contain only even length substrings. Thus, no solution exists.

        If $$$y = 1$$$, the string looks like aaaaaaabaaaaaaa. As the string is a palindrome, partition with one substring doesn't work. The string contains only one $$$b$$$, which can be contained in only one of the substrings. Any split with more than one substring must have a substring with only $$$a$$$, and thus, be palindrme. No solution exists.

        Otherwise, we can split $$$s$$$ into $$$s[1, k+1]$$$ and $$$s[k+2, n]$$$: split aaabaaabaaabaaabaaa into aaaba and aabaaabaaabaaa.

        $$$s[1, k+1]$$$ isn't a palindrome since the substring has more than one $$$a$$$ ($$$x \gt 1$$$), followed by a $$$b$$$, followed by an $$$a$$$.

        $$$s[k+2, n]$$$ isn't a palindrome, because the substring has at least one $$$b$$$ ($$$y \gt 1$$$), its prefix has $$$x-1$$$ $$$a$$$'s before the first $$$b$$$, and its suffix has $$$x$$$ $$$a$$$'s after the last $$$b$$$.

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

      I tried so hard in E with dp: dp[i] describe if we can divide in the first i position such that no partition is palindrome. Then dp[i] |= dp[j — 1] for all s[j...i] is not a palindrome. Do you think it is possible to do like that as I can't optimize

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

Is $$$O(n \log^2(n))$$$ intended to TLE on F?

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

    Basically, is this intended / close to the intended?

    • Q and Q.P are linked, so same logic as [problem:https://codeforces.me/contest/1918/problem/B], min inversions for Q = [1, 2, ..., n], max inversions for Q = [n, n — 1, ..., 1]. Additionally, any swap that increases the number of inversions in Q either increases the total number of inversions by 2 or keeps it the same.

    • Since we only increase by +2, if we increase the number of inversions in Q with a consistent algo, we will eventually reach any combined sum of inversions possible in the range.

    • So binary search on the number of inversions in Q such that combined sum of inversions $$$\geq k$$$. The inversions of Q can be built in the normal manner (place largest value possible while inversions > 0, then place remaining values in ascending order).

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

What a "nice" round. :)

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

literally spent 2 whole hours on problem B received 14 WA rig myself looking for pref sum, segtree, ternary search, could've solved D if not

I'm going to buy a rope today.

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

I guess I have been to enter an Educational Round.

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

I regret registering in this contest Out of my stupidity, I'll find myself a rope.

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

Damn, spent 2 hours trying to figure out why my code gives wrong answer on pretest 2 for problem D(

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

Missed D, can't think about "no" case :sob:

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

Proof of C: Need to minimize the expression $$$\sum_{t=1}^{n} (\sum_{i=1}^{t-1} x_i) \cdot x_t + a_t \cdot x_t$$$ subject to $$$0 \leq x_t \leq m$$$ and $$$\sum_{i=1}^{n} x_t = k$$$. By algebraic manipulation, this can be simplified to $$$\frac{k^2}{2} + \frac{\sum a_i^2}{2} - \frac{1}{2} \sum_{t=1}^{n} (x_t-a_t)^2$$$. Note that $$$(x-1)^2+(y+1)^2 \leq x^2+y^2$$$, for any two distinct integers $$$x \gt y$$$. Thus greedy solution works. Sort array $$$a$$$ and choose the maximum possible quantity in each step.

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

2 solves for Problem I. I believe I was able to derive a solution that would run in O(k*E*log(E)) which would be 2 billion iterations in worse case, so too slow. Really curious what the approach was to that one. If k <= 10^6, it is a much easier problem.

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

I am so close to solving F. I figured out how to determine YES or NO, but I don't know how to construct the answer in less than $$$\mathcal{O}(n^2)$$$ time. Could someone give me a hint? Thanks.

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

    How do you construct a permutation of size $$$n$$$ with exactly $$$k$$$ inversions? Needed algorithm is very similar

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

      I will try to fill in all integers from $$$1$$$ to $$$n$$$. I will maintain a variable pos starting from $$$n$$$.

      If we put the current integer into pos then the number of inversions will be increased by (pos - 1) since all blanks before pos will be filled with integers larger than the current one. If (pos - 1) is too large then just decrease pos and try again.

      The problem is, in this specific scenario the number of increased inversions is kind of "continuous". You can always find a position to fill in. However in problem F it is not the case.

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

        Ok, thats another way to construct a permutation with exact number of inversions, idk maybe its possible to solve with it too? But what I did: I iterate on positions from $$$1$$$ to $$$n$$$ (not integer) and see what number do I place on this position. It's either minimum available number or maximum available number until you are in a spot when you can construct all remaining suffix easily

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

Nice set of problems, thanks!

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

A is harder than D

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

Summary of the contest

Still love the contest though lol, I think the problems are nice

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

What is the idea behind D?

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

    If n == k, then you can only have one stall with price = 1, and k > n is trivial.

    Now, you can observe that for k <= ceil(n / 2), you can always have two stalls, with the first having price n — k + 1 and the second having price 1. This lets you construct an answer for all k <= ceil(n / 2).

    Now, if k doesn't lie in either of the ranges, i.e. k > ceil(n/2) and k != n, then you can't construct an answer. Since you k < n, so you must buy k/x jewels from the first stand, where x >= 2, which leaves you with less than floor(n / 2) coins and at least one jewel and now you can buy at max floor(n/2) jewels, i.e. you have at max floor(n/2) + 1 jewels, but as k > ceil(n/2), you can never reach your goal

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

Yet another round full of constructive problems. My brain has already crashed.

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

Nice problems, surely deserves a Global Round!

Though G is somewhat technical (We can use this method for all problems of this kind), I enjoyed an unexpected cubic formula.

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

    Yeah honestly I'm still tripping myself over that comment to this day. What does he mean by "for all problems of this kind"? From my understanding maybe he means if we describe state $$$S$$$ as a sequence $$$(s_{1..n})$$$ then we can just use the potential function trick. But surely there's gotta be some additional conditions on the transitions $$$S \rightarrow S'$$$ right? How can we be sure that solving for potential functions actually gives a solution when there are a lot more equations than variables?

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

      In fact I don't perfectly understand "all problems of this kind", either, but I interpret it as: we should try to construct a potential function when we see a problem with a Markov process whose states are points in high dimensional space but the transitions are "locally". From my experience it is almost(?) always the case that $$$\sum_i s_i$$$ is constant.

      Also, there is a Japanese editorial which tries to find a nice sufficient condition for this method to be useful.

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

My solution for problem E ( But I am not sure whether it'll pass the system tests ):

I had an intuition that if the answer is yes, then you can divide it in one prefix and one suffix. Hence, I picked a random index 60 times, and checked whether a division of a prefix and suffix bordering at that index gives two non-palindromes.

Code

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

The greatest contest i have ever participated.The examples are so strong that I could pass examples even when I misread the statements.Really love it!

btw,you see D $$$k \lt =60$$$,in fact $$$k\le 2$$$; you see E $$$k\le n$$$,in fact $$$k \le 2$$$.So cool,isn't it?

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

    Ough, that's big number of WAs. When I am quite sure that my solution is correct, then after the first WA I write a stress, even for first problems.

    So cool, isn't it? — yes, I don't see a problem here.

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

      In fact,each time I submit,I found a new problem.Passing examples only meant I wrote a compiled code at that night.That's really an awful experience.

      I don't think it's correct to hide the constraints of constructing steps in this way,which makes this problem's discrimination quite randomized. At least I hate it.

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

        Wait till you get to know of the old contests where writing compiled code = passing pretests.

        I dont see any issue with weak samples and wish more authors had weak samples. Its upto you to ensure that your code is right, samples imo should only be for verifying that you understood the problem right.

        I do make an exception for problems where the implementation might be difficult/tricky however, but most of cf problems arent like that, and you get wa because you are guessed.

        Personally, when i guess (and I do occasionally), i dont blame my skill issue on authors. Maybe try proving? I was completely sure of A — E when submitting

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

          Well,I could say that I was not guessing with problem BCE that night(Eventually I passed them).I just wrote,and got WA,and found the examples useless at all.

          That's also other reasons:I misread C;I solved E in a very difficult way at first; I thought about problem B with a incorrect proof. But all of these couldn't be checked by examples,and I was not patient enough,finally led to a bad result.Unlucky,but on another hand coz I'm still too weak.I posted this text because I was very unhappy and my head was totally a mess at that time,so maybe it's a bit funny.

          IMO,I think examples are used to check our ideas and common situations.If you don't want to give samples make sense,I think giving no samples could be a better choice(show the attitude to the contestants,but Codeforces seems not to allow this)

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

            "IMO,I think examples are used to check our ideas and common situations.If you don't want to give samples make sense,I think giving no samples could be a better choice(show the attitude to the contestants,but Codeforces seems not to allow this)"

            no i want samples to be there, but on problems where people will make lots of wrong guesses, i support making them weak on purpose so that guesses can be punished. Not putting any samples is too much and will lead to even more people just misunderstanding the problem.

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

            We actually tried pretty hard to make the samples useful. For example, B's samples highlighted the harder of the two cases in the intended solution, D's samples showed that it is impossible to solve when $$$k \gt \lceil n / 2 \rceil$$$, and for E we showed that a palindromic string can indeed be partitioned into non-palindromic strings.

            I believe luck was just not on your side on that day :( We didn't try to manipulate the samples in any way that obstructs people, but constructing samples that counter misreading is really hard because there are 10 million ways one can misread a problem ...

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

Hmm, for last several months this is the third problem which requires checking if substring is a palindrome using hashes.

1951E - No Palindromes

1943B - Non-Palindromic Substring

ABC331F — Palindrome Query

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

    "Requires" is too strong of a word. 1943B - Non-Palindromic Substring can be solved without hashing, and my solution to 1951E - No Palindromes even uses the naive algorithm for checking if a string is a palindrome.

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

    My solution to E today was casework.

    I split into segments of consecutive characters. If even number of segments, we can just pair segment[i] to segment[i + 1] and we're done.

    Odd number of segments: if there is a position where segment[i] != segment[i + 2], we can make a segment starting from i + 1 and extend it equally as much as possible to both left and right. After that, there might be an even number of segments left which we can pair off just like above.

    Now we have alternating segments. We can look for a segment[i] where i is odd (0 indexed). If the length of segment[i] >= 2, we can break into two distinct segments, and then pair up like the even case.

    If we still have not found anything, we can look for a segment[i] where i is even and i is not the first or last segment. If the length is >= 2, then we can s into two strings [0, x] and [x + 1, n — 1] where s is somewhere in segment[i] (basically split somwhere in segment[i]).

    Now the only thing we should have left is an odd number of alternating segments of length 1. We can prove that this is impossible to split because after splitting, there is guaranteed to be at least one odd length segment but this will always be a palindrome.

    Submission: https://codeforces.me/contest/1951/submission/255365657

    Unfortunately, I did not finish this during the contest qwq.

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

Clean code for C:

for _ in range(int(input())):
    n, m, k = map(int, input().split())
    l = list(map(int, input().split()))
    l.sort()

    ans = 0
    c = 0
    for i in l:
        ans += min(m, k) * (i + c) 
        c += min(m, k)
        k -= min(m, k)
    print(ans)
»
2 года назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

Finally...finally!!!!!!!!!TAT

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

CM finally?

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

A-E probably worst set i've done since traktor round. Maybe it gets better after...

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

Does anyone know why the first submission for E is skipped? Submissions for Global Round 1951

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

How to D?

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

Is there a solution for D using $$$O(\log V)$$$ stalls? Otherwise what's the purpose for setting the limit to $$$60$$$?

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

Thanks for amazing comeback of GR!
How to came up with problem C? It has very cute conclusion though it has very natural settings.

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

    Glad you liked it!

    Here's the lore for the problem:

    One day I randomly thought about problem A from this legendary TMW video and wondered "how could I make this problem more interesting"? Then I came up with adding the tax (note that the original only has $$$m=1$$$ so adding the tax only increases the answer by $$$\frac{k(k+1)}{2}$$$, the greedy obviously still works). Then I realized allowing to buy $$$m$$$ items per day doesn't change the strategy as well! (I then tried to have different limit for different days but it obviously didn't work)

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

D felt like an april fools problem, the main difficulty is figuring out which trick the setters are trying to pull (like putting s <= 60 and not putting n = k in the samples)

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

Thanks for the round! Though Im most likely biased I think all problems till F are very nice (and no idea about GHI) :)

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

May there be no constructive problems in heaven.

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

I feel like my experience was quite unfortunate:

I submitted D, thought I had correct proof, WA2'd. Realized my proof was incorrect, so tried to prove for a while. Couldn't come up with a counterexample, so brute forced n and k up to 1000 and that didn't cause a counterexample. Gave up on proving, and realized that my original solution was correct if I printed long longs instead of ints, so wasted like 30mins.

E: Guessing the solution is really obvious, but I also tried to prove. Gave up on proving after a while and AC'd.

F: Really easy and free, since it's a constructive there isn't anything to prove, but wrote a slightly incorrect solution because I wasted too much time trying to prove earlier problems.

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

C was very cool!

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

I got TLE #47 on problem E because wanted to make sure that no solution of length 3 exists. My solution did approximately 50N palindrome checks with hashes and shouldn't fail. CF servers are very bad and it costed me a lot of score :(

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

    After the contest I found out that 43N checks passed in almost 2 seconds. Codeforces servers are very slow, unfortunately. Where can I found the exact hardware description of CF servers? cc: MikeMirzayanov

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

    It's not really the server's fault. The constraints here are $$$10^6$$$ (a bit higher than usual), and you're doing $$$50N$$$ checks with double hashing and checking both sides, with double modulo application for each computation. You're essentially doing $$$400N$$$ mod operations. Now if it were addition or bit operations, expecting $$$4*10^8$$$ operations in 2 seconds is reasonable, but that many MOD operations are quite slow and I'd be surprised if it's much faster for you locally.

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

Auto comment: topic has been updated by Kuroni (previous revision, new revision, compare).

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

D won with me. GG

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

Can I ask what were your expectations when you set Problem E at that position? Were you thinking that many people would guess or rather thought, people would not guess since it is E, it can't be that easy. Just curious? (I wish I submitted D:)

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

First Div. 1 win! The second hour of this contest (solving FGH in a total of an hour after taking 52m to solve A-E) was probably one of my best-ever comebacks, up there with solving CD in the last ten minutes of Round 706 and solving five problems with my team in the fourth hour of NAC22. Very memorable contest; thanks to the authors!

Feedback on the tasks: A: Good enough as the easy problem. Samples are weak and didn't include the exactly two 1's case, which led me to take an unfortunate early penalty.

B: Good problem. It took me a while to really wrap my head around the setup, but once I did the solution works out pretty nicely.

C: Nice problem; the solution isn't immediately obvious but is relatively easy to see once you write out the price function formally.

D: Fine problem. A bit more focus on guessing than I'd like, but in fairnessonce you just try a few cases I think the approach is pretty well motivated.

E: Not my favorite problem, mostly because I suspect from post-contest discussions that most people who implemented the easiest solution (checking if any one-split approach works) didn't prove that their strategy was correct. There's also an alternative casework solution (which I implemented) where validity is easy to prove but implementation is much longer.

F: Nice problem; permutation compositions are always intimidating, but in this case looking at the number of inversions each pair (i, j) will contribute makes it a lot more clear what to do. Figuring out how to construct the permutation took me a few more minutes than I'd have liked, since the ideas I had seemed infeasible without some kind of fancy data structure, but then I realized that the construction always follows a simple pattern, after which the implementation was pretty straightforward (especially because the only data structure required is OST).

G: Very good problem--a bit on the standard end (especially for any contestants preparing for quant trading interviews?), but evidently it wasn't well-known to many participants. I hadn't seen this exact setup before, but I had seen enough very similar problems that I immediately knew how to find the probability that each marble is the last one standing and that I needed to compute the expected time until each marble is the only one left, conditional on that marble being the last one. The idea is nice enough that I really liked the problem, conditional on most contestants not having seen it before.

H: Good problem, but strangely easy for its position imo. I might have gotten a little lucky, but it felt like the first thing I tried basically worked right away. I think this is easier than G (and one could argue that the difference in solve counts is just the leaderboard effect).

F and G were my favorite problems from the round. I had to spend a bit more time on the easy problems than I would have liked due to doing casework on E and taking penalties on A/B (though both were really my fault for some pretty silly implementation errors), but the back half of the contest was very nice. Thanks for the round!

As an aside: after this month I'm starting a new job, and I expect to have significantly less time to train. Given that I've accomplished the bulk of what I've set out to do on CF, I think there's a pretty good chance I retire from rated contests at least for the time being. That being the case, I'm hoping to continue to engage with the community by regularly testing rounds, so if you're an author looking for testers for your upcoming contest, please feel free to DM me!

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

Nice round. Thanks a lot MofK Kuroni and all testers.

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

I'm very unsatisfied with this "unbelievable" round

3 constructions,2 of them use k < 3 conclusion

guess guess and guess

I can't learn anything except guess from the "global" round

I'll DOWNVOTE it

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

    My thoughts exactly. I guessed C, D and E and didn't get AC on neither D nor E because I was scared to write those guesses. Judging from the comments majority of people who solved them did not even prove their solutions to either of these problems which just makes the contest experience awful.

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

    maybe try proving?

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

      well D is just plain bad even if the guessing is really easy to prove

      would be far better if the number of stalls are $$$\leq 2$$$ (although it may not be D anymore)

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

        I mean, we can argue about quailty of problem D, because its plain math, and someone dont like it in CP contests, sure

        would be far better if the number of stalls are $$$\leq 2$$$

        However, I really dont understand this take. I think problem would be worse? Because with $$$\leq 60$$$ I just solved problem the way it is, in the end just noticed that it takes $$$2$$$ at most, ok fine, go next. Like, I never guessed "hmm maybe $$$2$$$ is always enough?" while solving problem, and I want to believe that most participants didnt too? Because this really seems like a completely desperate out-of-nowhere guess without motivation behind it?

        If problem had $$$\leq 2$$$ in statement, that would be very weird constant which would attract attention in the first place and completely changed the line of solving a problem, making it worse

        Also $$$60$$$ is a maximum theoretical limit since $$$n \mod x \leq \frac{n}{2}$$$ for all positive $$$n, x$$$, so this exact constraint seems motivated

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

          yeah, i kinda agree with your point. now that i look at it, the $$$\leq 60$$$ constraint is very much reasonable, especially seeing that the actual mechanism of how Alice spend the coins resembles the modulo operation for coins and division operation for jewels. i'm probably just mad about this constraint because of how it deceived me into thinking about bitmasks solution before even realising it's just the nature of modulo itself. still, D is overall very weird in my opinion, probably because the solution involves some guessing.

          anyways, good point. upvoted :>

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

I Just want to share my sadness:

TLE on testcase 46: https://codeforces.me/contest/1951/submission/255345491

AC: https://codeforces.me/contest/1951/submission/255365135

One code IS in C++17, while the other one is in C++20. I would get master with this ac :(

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

Thanks for the round, prove of C is beautiful, and I learn something today :)

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

Im finally Expert!!! Thank you Codeforces!

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

Got the wrong answer on D because of Python. Python does not divide bigger numbers correctly. :(

from math import ceil from decimal import Decimal

def solve(): n, k = map(int, input().split())

if k > n:
    print("NO")
    return
elif k == n:
    print("YES")
    print(1)
    print(1)
elif k > ceil(Decimal(n / 2)):
    print("NO")
else:
    print("YES")
    print(2)
    print(n - k + 1, 1)

for t in range(int(input())): solve()

This is the code on which I got the wrong answer. Dont want anything but wanted to share my misery.

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

Guessforces

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

Felt the samples very pretty weak. Had wrong attempt in almost every question :(

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

Why everyone finds D ques difficult?

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

Is the song from Problem D on Spotify? I found this https://open.spotify.com/track/1TVFphEyfjzEIir70656d4?si=68360585a1254339 but this is without Jonsu :/

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

TaklaOI orz?

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

intuitionforces

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

When you thought you could solve the problem F without a stress test :'(

Screen-Shot-2024-04-07-at-01-10-11

And also in my opinion H was a very easy problem for the position H.

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

G is absolutely beautiful!

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

"Xin chào" is similar to Chinese pinyin(

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

haha funny picture

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

Who gets t-shirts?

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

Since problem B is tagged with binary search, has anyone implemented a solution using binary search? I’d like to see it, because I can’t figure out the idea. Thanks!