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

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

(After 3 months) Hello again, Codeforces!

We are glad to invite you to participate in Codeforces Round 968 (Div. 2), which will start on Aug/25/2024 17:35 (Moscow time). You will be given 6 problems and 2 hours to solve them. Two problems are divided into two subtasks.

This round will be rated for participants whose rating is below 2100. Participants with higher rating can participate unofficially.

The problems were authored and prepared by me.

I would like to thank:

Scoring distribution: $$$500 - 750 - 1000 - (1000 - 1250) - (1750 - 1000) - 2500$$$.

Good luck & Have fun!

UPD1: Editorial and also Simplified Chinese Editorial are out.

UPD2: Congratulations to the winners!

Div. 2:

  1. Empty_Dust
  2. cz_yxx
  3. Hosen_ba
  4. farkon00
  5. _minhduccp

Div. 1 + Div. 2:

  1. jiangly
  2. ksun48
  3. kotatsugame
  4. Sugar_fan
  5. Golovanov399
  • Проголосовать: нравится
  • +449
  • Проголосовать: не нравится

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

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

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

As a tester, there are some beautiful ideas in the tasks, and I encourage everyone to participate!

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

    Is there a big gap between the levels of B and C like old contests?

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

      I doubt he is allowed to share that info, and even if he did share, difficulty is subjective.

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

      No. Compared to the old one, the questions for this competition have been adjusted to make the difficulty distribution more reasonable. :D

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

It will be my second contest in Codeforces, and I am looking forward to it!

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

    How is your E1 from today already skipped with no resubmissions? And how come your "first" contest 3 months ago was set by the same author?

    There's no such thing as a coincidence

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

First rule of fight club is: "Don't trust the scoring distribution. Especially if it's a Chinese round."

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

    Yeah I thought of maybe till D(easy version) can be easy but since u warned I am gonna try till C

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

As a tester, I not only tested, but also tested twice. There may be some unforgettable problem. Enjoy it!

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

As a tester, GL&HF

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

Me looking at the setter:

  • Their last contest nearly dropped me down below 1700.
  • This time they had two subtask-enabled problems, adding consistency dread and doubts regarding tactics.

Oh dear... Welp, at least this time I'm out-of-competition so I'd be safe... :D

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

hoping to not reach green after this one

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

As a tester and a fan of zltzlt, zltzlt orz.

The problems are nice, gl&hf!

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

As a tester I cried because how beautiful the problems are

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

You

for participating. was cool
»
4 недели назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

Wow,CN Round!

But the Chinese need to stay up late to participate...

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

I'm a tester?! /jy

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

500−750−1000−(1000−1250)−(1750−1000)−2500. what this mean i don't understand the distribution? can anyone explain? Thanks.

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

    it means if you solve the question A, at the minute 0, you will gain 500 points. if you get a wrong answer verdict on that question the pointes you will get becomes lower, and over time in every minute gets passed, the maximum score that you can get also decreases.

    some problems have subtasks which are marked in parentheses, the first is the score you get if you solve the easy version and the second is if you solve the hard version

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

    This means

    Problem A: 500 pts

    Problem B: 750 pts

    Problem C: 1000 pts

    Problem D1: 1000 pts

    Problem D2: 1250 pts

    Problem E1: 1750 pts

    Problem E2: 1000 pts

    Problem F: 2500 pts

    Point values decrease if u get one wrong or as time goes on.

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

As a participant, I'm waiting for this div to be amazing.

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

I think I will become a pupil in this contest.

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

Hoping to get to CM! I'm so close yet so far...

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

    good luck

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

    I checked your stat on Codeforces Visualizer 4fun. Why on earth you solved 213 800-rated problems and only 9 1900-rated :)

    no blame or something, just curious.

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

      You might notice my Codeforces streak :)

      When I have school, I quickly solve an 800 rated problem to keep my streak alive. Right now, in my time zone, I have a 239 day streak.

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

      It's fine, I've only solved 11 1600 rated problems. He's definitely qualified to reach CM with 9.

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

hopefully i can get a +1 delta to become specialist after this contest

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

I hope this contest will be better for me and eagerly waiting for it...

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

It seems like strategy matters after solved ABC now. Either use speed on D1 E1 or upsolve D2 or E2 (Hope I solved ABC first rofl)

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

Hoping to get just 1 more rating

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

Hope this contest goes well for everyone. Best of luck to all participants!

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

Time to Ctrl+Z my sanity and dive in!

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

this will be a great round

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

As a tester (but tested E only), E is a good problem!

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

Hoping to get a color after this round (⁠ノ⁠^⁠_⁠^⁠)⁠ノ

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

Best Wishes!

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

i like tacos

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

Programmers in unlucky timezones participating in this round at 22:35pm:

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

8 problems!

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

welcome again brother @zltzlt . please be affectionate ಥ_ಥ

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

Good luck to all participants!

Wish $$$\mathrm F<{}^*3000$$$ this time :)

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

hope back to expert:)

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

Best of luck to all of you

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

Hello brothers. I an ew into this sort of thing so my question is" i see 500 score 750 score " when ever i did any question here on problemset its 800 score so it means these scores are of same category or they are different during contest and problem set.

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

    these are not problem rating . these are the score you get from the problem.

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

      see this question "https://codeforces.net/problemset/problem/4/A" here in problem tag i can see *800 or difficulty 800 . So i want to know that score 500 is more difficult than 800 or not thankyou.

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

        When you solve a problem in problemset, it shows you the estimated difficulty rating of that problem. For example, if a problem is rated 1000, that means that a 1000 rated person should solve it 50% of the time in a contest. The 500/750/1000... score of a problem shows how much points you get if you solve it in contest. Generally, harder problems carry more points.

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

hope to become pupil, need to solve first two problems faster.

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

potato

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

How can I participate?

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

But i'm Chinese,the time is so late that my mom don't allow me to register for it.But i believe i can register it in 2025.

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

hope you all get +delta this time

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

hey! i usually grind on cf and practice x to x+300 (x is mine current rating) but when i practice i usually stucked on it and cant solve by own and majority of problems i cant solved by own while practicing , is it common or i am just doing some mistakes , please help me

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

    I think if you solve 800 problems just for improving implementation,it would be better.

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

      I think , i can solve 800 more than 90 percent but i am talking about solving problems higher than my rating

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

    stucking is very common everyone gets stuck and reading editorial is not bad then just read the editorial understand it and then implement it simple. If in editorial there is a topic mentioned which u don't know then just read it first then implement the solution with that logic. It is obvious u will get stuck if u are solving higher rating problems

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

thanks

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

mathforces incoming

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

Hope for Salah7_a

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

hoping to get into green with this one

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

so many newbies solved till D2 and here I am not able to understand D1 :(

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

Never been cooked this bad :(

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

solved ABC but I'm too slow... Prolly need more practices sadge

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

aryanc403 beat rainboy today :)

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

    Meanwhile,

    rainboy [thinking] :===> aryanc403 ... who ! what ! where ! Am I supposed to care !

    PS : I am also fan of Aryanc, but Rainboy has different Aura to him. so, please don't get offended.

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

      No, nothing offensive, and i know rainboy only solve those problems having low submission count so if he solve last 2-3 problems within 30-40 mins he will not even touch the 4th problem from last, obviously he have a different aura :)

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

GuessForces

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

how to solve B, I honestly have absolutely no idea, was able to guess the correct solution at the end of the contest

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

    just print the middle element after sorting!

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

    Hint for B:
    -Turtle will always try to eliminate the smallest element present in his operation and if there are duplicate then he will eliminate that which is dangerous to max possible element around the vicinity of all those smallest elements.
    -Piggy in his turn will try to eliminate the largest element present in that operation and if there are duplicate then he will eliminate that which is dangerous to min possible element around the vicinity of all those largest elements.

    Overall Turtle will try to take the result towards larger value and Piggy try to take it towards smaller value and optimally they will end at the value at the mid of the array when sorted.

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

    It's easy to see that Turtle can achieve at least value x, iff there are at least [n/2] values i of array such that a[i] >= x.

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

    Consider a similar game, but the move is "remove an element" for both players.

    An optimal strategy is for Turtle to always remove the smallest remaining element and Piggy the largest remaining.

    Observe that the given operation effectively boils down to "remove an element as long as it has a smaller (Turtle) / bigger (Piggy) element next to it. As such, the optimal strategy does not change for either player.

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

    The idea of my solution is: Turtle will always remove the current smallest, and Piggy will always remove the current largest (My intuition was that a player should remove the element that is the most disadvantageous to him, or there will remain some element that is disadvantageous towards the end, thus not giving an optimal result to him)

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

How to solve C? D1+D2 feels 100x more obvious to me.

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

    im ngl i just guessed and it worked. my solution was to count the freq of each character, and then to print all the characters with the current max frequency.

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

      I guessed the same, I'm aiming to print the maximized s[i]!=s[i+1] but I ended up the same strategy as you. I used brute force to check my answer again and it's absolutely fine and doesn't know how to prove it.

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

    I sorted the charachets in descending order of number of occurences.

        string s, x = "";
        int n;
        cin >> n >> s;
        pair<int, char> a[26];
        for(int i = 0;i<26;++i) {
            a[i] = {0, (char)('a' + i)};
        }
        for(const char& v:s) {
            a[(int)(v - 'a')].fi++;
        }
        sort(a, a + 26, cmp);
        while(true) {
            bool ok = true;
            for(int j = 0;j<26;++j) {
                if (a[j].fi > 0) {
                    x+=a[j].se, a[j].fi--, ok = false;
                }
            }
            if (ok) {
                break;
            }
        }
        cout << x << endl;
        return;
    
  • »
    »
    3 недели назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    How to do D1, I tried finding the maximum mex for f(0), then I print the answer mx*(k) for the highest k such that f(k)<=mx otherwise I added m*(m+1)-k*(k-1)/2 to the answer.

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

      I solved it that way, maybe you had a bug in your implementation?

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

        can you help me debug it...

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

      for every sequence its maximum value you can get from it, is the mex of the sequence with the mex of the sequence included. find the maximum value for that out of all sequences, and then for all values of m that are less than it, replace with that value, and for others you just use the value that is given. the last part is just formula so its a fast solution

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

      For a given array $$$a_{i, 1}, \cdots a_{i, l_i}$$$, there are two possible results depending on $$$x$$$:

      • $$$mex(a_{i, 1}, \cdots a_{i, l_i}, mex(a_{i, 1}, \cdots a_{i, l_i}))$$$ if $$$x = mex(a_{i, 1}, \cdots a_{i, l_i})$$$

      • $$$mex(a_{i, 1}, \cdots a_{i, l_i})$$$ otherwise

      So for any array we can achieve $$$mex(a_{i, 1}, \cdots a_{i, l_i}, mex(a_{i, 1}, \cdots a_{i, l_i}))$$$ for any starting value.

      So find the max such possible value among all arrays, let's say it is $$$x$$$.

      Clearly answer is $$$x$$$ for $$$1 \leq i \leq x$$$ and $$$i$$$ for any $$$i \gt x$$$.

      So the sum is $$$(min(m, x) + 1) \cdot x + \sum_{i=x+1}^{m}{i}$$$

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

        Yes sir.. that's what I did, don't know why it got murdered at pretest — 2 can you help me debug it...please help..

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

          I just want to know why, too. That's very hard for me to find reasons..

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

can someone tell me how f(4)=4 in problem D testcase 1??

»
3 недели назад, # |
  Проголосовать: нравится -14 Проголосовать: не нравится

Judging by the solve count, with the addition of one more hard problem this could've been a Div.1 + Div. 2 round.

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

almost 5k solution for D1. is it really that easy ?

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

278148861 was trying something unique for D2 , but had no time to debug :( . Solved 4 still gonnna get negative.

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

"You for participating!" was good

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

First time able to solve A-D in a div-2 contest

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

Spending more time for reading than coding. The description is too long, and I can't really understand what're the problems talking about. We should spend more time on thinking algorihms, not for reading.

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

Can someone explain how D2 's first sample test

3 4 2 0 2 3 2 3 3 4 7 0 1 5

how is f(0)=3?

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

A really screwed me up as I didn't read that i<j.

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

p013lPh7 didn't solve E1? bruh.

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

    sorry im dog, im indian dalit,in our country we cant study, im lowerclass , sorry my bad, i cant

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

Couldn't figure out any algorithm for B, after a lot of observation just observed middle of sorted element happens to be answer in test cases.. donno how that worked! LOL

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

    As Turtle wants to maximize the last value(remaining one),he will start by removing the smallest one in order to avoid small values.On the other hand Piggy wants to minimize the last value(remaining one),so he will start by removing largest one in order to avoid large values.Then after the process(Turtle always removes small values and Piggy always removes large values) ends,the remaining element will be definitely the middle one of sorted array.

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

C is my least favorite kind of problem, pretty easy to guess but much harder (imo) to prove a solution.

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

    What was the easy guess for C? What i guessed (and worked) didn't look very obvious and took me 1 hour.

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

      the guess is make adjacent elements different also took me 1 hr

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

      Frequency counter for letters, then append the letter with highest frequency to answer until you're out of letters.

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

      Print alternating characters sorted by frequency descending...

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

      i dunno i'm fast recognized what if i set same letters near each other, its minimize pairs

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

How do I approach D1?

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

    Hints for D1 and D2

    What is the first thing that we know about mex? Mex of $$$n$$$ integers is at most $$$n$$$. Therefore, if we were to perform at least one operation, $$$x$$$ can grow no longer than the maximum $$$n$$$ in the input. Therefore, the constraints $$$m \leq 10^9$$$ essentially means that $$$m \leq 2 \cdot 10^5$$$, since after this point, it's optimal to not do any operations on $$$x$$$.

    This gives us confidence to calculate the answer for each $$$f(i)$$$.

    Consider any list. What happens when you apply the operation on it. Remember that the $$$mex(L)$$$ is missing from this list, therefore, if you don't provide $$$mex(L)$$$, it'd still be missing. Hence, you can only get back $$$mex(L)$$$.

    But what if you do provide $$$mex(L)$$$ to fill in the gap? You'll get back the second missing element.

    Hence, a list can only improve your answer equal to the second missing element. Hence, the answer is the maximum of the second missing element from each list.

    But what if you are only allowed to use one list at most once. Then, you can think of it as a neural network, where the output of one layer is the input of the other layer. Then, create a directed graph where each list contributes on edge $$$m \rightarrow sm$$$, i.e, it is a neural network that takes in a missing element and outputs the second missing element.

    Notice that this would be a DAG since edges are from small to large. Then, define $$$indp[u]$$$ to be the max vertex reachable when you start at vertex $$$u$$$. Clearly, $$$indp[u] = max(indp[child])$$$.

    Also, define $$$outdp[u]$$$ to be the max vertex reachable when you don't start at $$$u$$$, However, using one operation, you can get the opportunity of starting at $$$u$$$, therefore, if there are more than one outdoing edge, then $$$outdp[u] = indp[u]$$$.

    Then, $$$f(u) = max(indp[u], outdp[*])$$$ where $$$*$$$ is everything except $$$u$$$.

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

      Does this necessarily require graphs? Is there any way to solve it without graphs?

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

        D1 doesn't require graphs, these hints involving graph are for D2.

        Technically D2 also doesn't require graphs, but it helps to visualize it if you are familiar with DAGs.

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

      ahhh, for D2 in the end i thought it could be solved with a graph, but i didnt have time to implement. thank you

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

    for each sequence, u look what number u get after selecting 2 times that sequence, then after that u take the maximum, say it is Max, for every 'i' smaller than Max u get Max, otherwise u get 'i'. Then just do the count and print.

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

For the 4th test case in E1, can't we make permutation: 6 5 8 7 4 1 3 2 with k1 = 2 and k2 = 6 total inversions = 22

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

As a tester i want to know what the heck wrong did the turtle do to the problem setter

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

Dumb me mistook the constraints for m as 2*10^5 in D1

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

My worst round ever despite solving a~d

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

Could someone please explain to me the answer for the 4th test case for D1?

How is f(1) = 3?

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

In C how abc is not good?

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

In the problems section some of my solutions are marked red although they passed pretests. Is this because my solution is wrong or is it because testing still ongoing?

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

How did people even solve D1, and why was it 1000, also god damn did B and C piss me off once i realized the solution.

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

    its easy man, i mean its just the finding the second mex of every array and then finding the largest among the array of second MEX's. what fcked was int overflow lost 120 pts cuz of it :)

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

      I believe the first test case already had overflow in it

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

        Exactly what i thought. But if you will look at my submitted solutions , the first and the third are the exact same but first fails on tc3 and third one accepted cuz I literally changed everything to long long :)

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

      Omg, now i feel dumb, why did i forget that you can store 2 mex's lmfao

»
3 недели назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

I submitted problem D1 first in C++23 and did not pass (for 3 times).

Then I changed the language to C++20 and it passed.

Why? MikeMirzayanov please fix it!

I lost 150 points in the contest because of this new language.

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

    https://codeforces.net/blog/entry/133046

    Please note that support for GNU G++23 14.2 (64 bit, msys2) is currently experimental. We invite you to join in the testing and experimentation process. Share your thoughts and experiences in the comments!

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

      So? Does that mean I deserve to lose points? If there are problems or bugs, shouldn’t the admin fix them and try to make the platform better?

      Experimental doesn’t mean that participants using it will fail passing, it just means it’s not perfect enough. We should find the bugs and report them to make it better.

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

        It means that g++23 has just been implemented on Codeforces and that it is as you said, not perfect enough. They warned you that it is experimental. Of course, it is not completely your fault and I don't blame you.

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

        Reading is your issue, not Mike's. they clearly said to not use it during contest

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

    There is probably an undefined behavior somewhere in your code, have you thought about it?

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

B is really cute

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

Please Help: If i lock my answer late does it take the late locking or the time of submission.Also if i do incorrect submissions on problems i didnt solve do i take peantly or no?

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

truly disgusting abc, simply cannot imagine any worse

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

Can anyone explain why f(3)=4 for second sample test of D1?

3 4 5 0 2 0 4 11 1 1 5 1 3 0 3 3

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

    You can use this sequence: 5 1 3 0 3 3 two times. First time it changes mex to 2 and again using it will make mex 4.

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

    By doing the operation on third array twice : 3->2->4

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

codeforces announcement

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

Guessforces... But I love guessing :)

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

Sorry zltzlt, problems are just guesswork. Not a good round.

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

    nvm

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

      How is it guessing if all of the problems you mentioned are easily provable?

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

        Easy proof for C?

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

          No matter how you rearrange the string, you can't change the number of pairs where $$$s_i = s_j$$$, so you focus on the pleasant pairs where $$$s_i \neq s_j$$$. So yo want to maximise the number of substrings of the form x...y...z, where x, y and z are pairwise distinct characters. One construction that achieves that is the alternating characters one since you don't benefit from having two equal adjacent characters.

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

      D is not guessing lmao

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

For problem D1, can we just find the max among the second mexes of all the sequences and then for each i from 0 to m, find f(i) = max(max among all second mexes, i) and then we just add all the f(i) ? I am not sure if the time constraint will allow this approach. Wasn't able to write the code in time :/ .

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

    Yes, that is how I solved it. You don't have to iterate all the way to m, you can just do this:

    if (m <= mx) {
        cout << mx*(m + 1) << endl;
    }
    else {
        cout << mx*(mx + 1) + m*(m + 1)/2 - mx*(mx + 1)/2 << endl;
    }
    
»
3 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

To solve D1, you must get the largest "second mex" (the mex if an array included the initial mex) of all sequences. Then just iterate from i=0 to i=m and add max(second_mex, i). I forgot to take max of i as well :(

Am I correct?

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

I solved D2 exactly at the end of the contest, time to kms :).

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

    any hints for D2 or it was same as D1!!!

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

      Hints

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

      just create a directed graph between the first and second mex in each sequence. and after traversing through any path, its end is the maximum value you can get. that's it, you need to handle some cases as well and try to do this effeciently

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

Can anyone explain solution for D in russian, please. I didn't understand the part with formulas

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

no proofs .. only hope

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

Hey guys, I came up with a special idea for C during the contest and it's too easy to implement -

Just sort the string, and print the string in an order like $$$1,n,2,n-1,3,n-2,\dots$$$, and that's all.

Can anyone prove it?

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

why so much guesswork nowadays?

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

great problem D.

nice problem set

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

I'm curious about how the checker was written for problem C

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

    they probably count the number of good pairs in their answer, and count the number of good pairs in your answer and compare

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

watch out for leaked solutions in today's contest, hope the ones who cheated get plagiarized!:)

C: 278153815

D1: 278154032

D2: 278155020

C: https://codeforces.net/contest/2003/submission/278154255

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

The contest was beautiful, but it became unfair due to cases of fraud and checking the security of the connection, which caused a huge delay. I hope this situation will be avoided. I did not provide a solution for more than 15 minutes due to verification

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

today i gave this contest it was my first contest and i was not able to solve any problem and friends did solve first 2 problems i usually do leetcode and i am able to solve leetcode medium with not that much difficult any suggestions on how to improve and able to attempt problmes

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

    Leetcode problems are very different from Codeforces problems. I assume you are decent at Leetcode problems because you started out with easy ones, then a bit harder, etc. For Codeforces, you can start with Div 4 problems if you are still struggling, then to Div 3, etc. You can use something like CFtracker to find problems of your difficulty.

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

Has already been system testing?

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

For D1, the solution seems to work for small numbers, but deviates a little from the answer for large numbers. Is the logic wrong or it has to do something with long long type in c++?

Submission link

Thanks

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

When do the ratings get updated?

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

I am on 1199 will they update the ratings afterwards if they find some people have cheated or something?

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

Thank you

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

Wow, I got question A right by luck. I compared the first and last indices of the string and submitted it after all the pre-test cases passed. Then I reread the problem and thought that multiple substrings could be made starting from index 2, each of length 2 (k >= 2). I compared index 0 to every even index and the last index, but the test failed. I thought, "Yep, still too dumb—0 questions solved in this contest, lol." But it worked!

a question people ,how to read/understand the question better ?

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

    One thing that you should keep in your head when solving A, B, C is that the problem cannot be very hard. A, B should be easy. But they can be obfuscated a bit.

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

can someone help me with problem D2, here's my submission : https://codeforces.net/contest/2003/submission/278173730 i have tried it for a lot of time, but cant figure out why there is mle, is my code doing something wrong (like something could be taking a lot of memory, its space complexity is more than that i can take in question) or its something else. Can someone please help?

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

Became Pupil.

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

bro the gap from b to c

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

The absolute difficulty level of B and C is much greater, and it could only be realised while you try to prove the correct solution.

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

After solving A,B
Stuck at C and go to D
Rating very bad.
Finally solve A B C D1 D2
Become expert again!

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

Could someone help me with D2 please? 278259567

IDK why it fails on test case 26, did all the optimisations that I could.

»
3 недели назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

I encourage authors and coordinators to use $$$5000$$$ instead of $$$5\cdot 10^3$$$, the second one can be easily confused with $$$3\cdot 10^5$$$.

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

    You are complaining about using scientific notation?? If anything, people should use scientific notation more. I dont usually blame my inability to read on authors, why do you?

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

      I'm not complaining just suggesting, from my point of view is better using scientific notation only for big numbers not small ones. Note that $$$5000$$$ is shorter than $$$5\cdot 10^3$$$, and scientific notation should be practical, not a fancy thing for those who believe that are better than others. You can write $$$20$$$ as $$$2\cdot 10$$$. Also if you can help contestants in the way I think is the best choice. I strongly disapproves those who thinks that readying and understanding what author mean to say is a problem solving ability. You(I mean authors in general) should make statements as clear and readable as possible

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

        I agree with all of your points that 20 should indeed not be 2 . 10

        However, at 5000, its a judgement call, you cant blame authors for a coin flip. I think both are fine at 5000.

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

          I'm not blaming just suggesting, I perfectly know is my fault if I misread something, and I can absolutely not blame authors about that. But I really think $$$5000$$$ it's ok because is small and if you help contestants to better understanding why not? I'm pretty sure I'm not the only one who got confused with this before. My point is that using $$$5000$$$ instead of $$$5\cdot 10^3$$$ can help people and only hurts those who believe that using scientific notation make them more intelligent

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

%%% zlt round

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

I recently received an email stating that my solution for the C problem in the contest coincides with those of other participants. I want to assure you that I have not engaged in any form of cheating or plagiarism.

I have been working diligently on this contest, and any similarities in the solution are purely coincidental. I am confident that a review of my older submissions will demonstrate my commitment to solving problems independently and with integrity.

Please feel free to reach out if you need any further information or clarification. I am more than willing to cooperate in any way necessary to resolve this matter.

Thank you for your understanding and attention to this issue.

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

Hello codeforces, my solution got skipped. I knew i would get skipped because i used this account for looking at my friends results from friends standings. And i participated in the contest from the other account ( the one which my solution is same with ). You can see that i only submitted 1 problem with this account, which has to be a mistake. Both of the accounts have same exact password. Overall, i didn't cheat...

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

Hello Codeforces, My solution of the C problem of this contest is skipped and I got a mail that it is matching with some other users. I want to assure you that I had written the code myself and didn't cheated anyway. I used the map for storing frequency and the code that I had written to traverse and delete at the same time, its the only way to do that. How can be my code skipped if I used common variable names eg. ans, mp, it. I always use these variable names. Overall, I want to say that I was not involved in any type of cheating and my solution shouldn't be skipped. Please re-check my solution.

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

Difficulty estimates (of problems I was able to solve).

A — 800

B — 900

C — 1400

D1 — 1500

D2 — 2100

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

Subject: Request for Review of Penalty on Question 4 — Codeforces Round 968 Div2

Dear Codeforces Team,

I hope this message finds you well. I am writing to request a review of the penalty imposed on my submission for Question 4 in Codeforces Round 968 Div2.

During the contest, I successfully completed the first three questions within 32 minutes. For the fourth question, I made observations and developed the correct logic, submitting my initial solution at 1 hour 4 minutes into the contest. However, due to a minor mistake in my approach to finding the second MEX, I continued working on the problem and submitted a revised solution at 1 hour 55 minutes.

Initially, I used a map to find the second MEX, but I encountered an issue due to a variable being incorrectly placed. To resolve this, I switched my approach and utilized a set to determine the second MEX. My approach was informed by the blog post available at this link https://cp-algorithms.com/sequences/mex.html .

I have received a notification regarding a potential violation related to my submission for Question 4. I believe the penalty might be due to the changes in my approach between submissions. I assure you that the changes were made independently as part of my problem-solving process during the contest.

I kindly request that you review my profile and uplift the penalty, as I believe this was a genuine effort to correct my solution rather than a violation of the contest rules.

Thank you for your understanding and consideration.

Best regards, KraitOPP

Mention cz_yxx Hosen_ba farkon00 _minhduccp Empty_Dust MikeMirzayanov

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

Why My Rating Not changes after solving A B C in This contest I got Mail regarding Plagarism Which I did't understand may be it was a coincidence. please reply

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

can someone please tell me rating of these questions....and how to know rating of contest questions

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

    the rating of question on codeforces will be updated after a few weeks (usually 3-4 weeks). Or this for quicker estimation. Of course those rating is just estimation... solve problem that you like is always the best.

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

What a nice round! Orz zlt%%%%

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

Attention!

Your solution 278111056 for the problem 2003B significantly coincides with solutions hydr0gen_per0xide/278110807, ankushmondal1y2t/278111056. 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.net/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.

what is this can't i give contest with 2 accounts ?? both are my solutions I didn't know its illiegal (then Iam sorry for that ) if it is then i will give contest by one accounts and is my account is blocked ?? will I able to get it back??

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

傻逼场