wyrqwq's blog

By wyrqwq, 3 months ago, In English

It's been a long day without you, Codeforces!

We are glad to invite you to take part in Codeforces Round 969 (Div. 2) and Codeforces Round 969 (Div. 1), which will start on Aug/30/2024 17:35 (Moscow time). You will be given 6 problems and 2 hours and 30 minutes to solve them in both divisions.

The problems are authored by LMydd0225, tzl_Dedicatus545, _FJqwq, Ternary_Tree_ and me wyrqwq and mostly prepared by LMydd0225. One of the problems is also prepared by DitaMirika.

We would like to thank:

Hope you will enjoy the problems!

Score Distribution:

  • Div. 2: $$$500 - 750 - 1000 - 1500 - 2250 - 2750$$$;
  • Div. 1: $$$750 - 1250 - 1500 - 2000 - 2500 - 3000$$$.

badges$$$^\dagger$$$ of the authors:

$$$^\dagger$$$: Began in 2022 at NOI Shanghai, Badge Exchanging has been an activity popular among Chinese CPers. The host school for NOI 2022 decided to print badges containing the avatar of contestants for the contestants, and one can exchange his or her badge with another. The collection of one's badges (of other CPer's avatars) shows the group of CPers that he has met and even made friends offline. It has achieved great success. And since then, it has been a tradition for years.


UPD: Congratulations to the winners!

Div. 1:

  1. tourist (Updated, and congrats!)
  2. jiangly
  3. ecnerwala
  4. Radewoosh
  5. Kevin114514

Div. 2:

  1. mkrukov07
  2. temp6
  3. wjq1234567
  4. bingpao
  5. AuSquare (It seems that the rank 5 was banned? So let's move on to rank 6!)

The Editorial is out. You can also download Simplified Chinese Editorial in the contest material of the Div. 1 part of the contest.

  • Vote: I like it
  • +845
  • Vote: I do not like it

»
3 months ago, # |
  Vote: I like it -62 Vote: I do not like it

thank you for no subtasks

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    Subtasks are good though because if you normally solve n problems with subtasks you you might have a chance to solve n+1 (or n+0.5) problems. And normally I have noticed the first subtasks of problem n is either of the same level or slightly easier than problem n-1.

»
3 months ago, # |
Rev. 3   Vote: I like it +206 Vote: I do not like it

As the girlfriend of tzl_Dedicatus545, may you good luck & give me contribution!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hope this contest is good!wish me luck!

»
3 months ago, # |
  Vote: I like it +60 Vote: I do not like it

Score distribution looks really odd. I think it would go something like this, wouldn't it?:

  • Div2: Div2A — Div2B — Div2C — Div2D/Div1A — Div2E/Div1C — Div2F/Div1D
  • Div1: Div2D/Div1A — Div1B — Div2E/Div1C — Div2F/Div1D — Div1E — Div1F

Btw, the badge custom is really cool, I wish I could have done the same when I was younger T.T

»
3 months ago, # |
  Vote: I like it +159 Vote: I do not like it

As one of the authors, good luck & have fun!

»
3 months ago, # |
  Vote: I like it +69 Vote: I do not like it

As a tester, the problems were good and I recommend everyone to participate!

»
3 months ago, # |
  Vote: I like it +61 Vote: I do not like it

As a tester, the problems were good and I recommend everyone to participate!(

»
3 months ago, # |
  Vote: I like it +67 Vote: I do not like it

I tested this round, and I hope you all enjoy it!

»
3 months ago, # |
  Vote: I like it +113 Vote: I do not like it

As a tester, hope you have fun!

»
3 months ago, # |
  Vote: I like it +197 Vote: I do not like it

As a tester, when my solution has a different output from the example during testing, I suspect the author first.

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it +40 Vote: I do not like it

    Fun Fact: The solution of Div.1 A was initially wrong when I tested the problem.

    Fun Fact II: 1A was in the position of 2C before we find out the mistake.

    Fun Fact III: There was another 1A before the current 1A was presented, and it was also wrong.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      I'm guessing this is referring to the sample with the same number of '1' and '0' leaves + '?' root + odd number of '?' non-root vertices? I feel like there would be a lot of WAs without that sample.

      I tried proving that that was the only "edge case" but just gave up and submitted after several hundred submissions AC'd :/

      I'm not even sure what you're supposed to do to solve that problem. Just be smart enough to prove it correctly and quickly, or assume that the samples are strong (which to be fair does seem to be a trend in As)?

»
3 months ago, # |
  Vote: I like it +71 Vote: I do not like it

Not as a tester, when can I obtain your badge wyrqwq

»
3 months ago, # |
  Vote: I like it +58 Vote: I do not like it

As a tester, I have two badges of one author but none of the other five XD

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Time to get a color change in this contest XD

»
3 months ago, # |
  Vote: I like it +24 Vote: I do not like it

As a tester who hasn't participated a contest formally on Codeforces for nearly an entire year, I hope all of you a positive delta.

»
3 months ago, # |
  Vote: I like it +46 Vote: I do not like it

As a tester, it's a very good contest and hope u have fun!

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

The badges are so cute!! Reminds me of trading Pokemon cards :)

I wish I would meet many CPers in real life and exchange ideas too. Also, good luck to all!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hope to reach 1550

»
3 months ago, # |
Rev. 2   Vote: I like it +45 Vote: I do not like it

As a tester ,wish you have fun and gain positive rating delta.

»
3 months ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

I hope my downfall will come to an end this week

»
3 months ago, # |
  Vote: I like it +25 Vote: I do not like it

As a tester, I wish all contestant having fun in this contest.

»
3 months ago, # |
  Vote: I like it -21 Vote: I do not like it

What cartoon is this.....,,,??.???,???

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    From four diferent cartoons...

»
3 months ago, # |
  Vote: I like it +18 Vote: I do not like it

is there any correlation between being weeb and high rating?

»
3 months ago, # |
  Vote: I like it +10 Vote: I do not like it

So as the photo says Problem D will be a graph problem?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    So the C will be need so much attention to be found?

»
3 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Anyone know the sauce for the top right badge? Also interested in the others too. I think top middle is from "Bocchi the rock"

»
3 months ago, # |
Rev. 2   Vote: I like it -19 Vote: I do not like it

FreeDurov****

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Were rating constraints for div 2 changed? Pretty sure it used to be 0-2099 yet I can't register(and don't see anyone with 1900+ rating registered).

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +30 Vote: I do not like it

    When Div.1/2 are hold separately, purple would belongs to div.1

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it +56 Vote: I do not like it

    Separated Div.1 contests only requires 1900 although they're not very common now.

    It has been 4 months since last separated div.1 contest. Interestingly, last time we also have wyrqwq and N_z__ and some other people as authors and testers :D

»
3 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

badges looks nice I hope I can get one someday

»
3 months ago, # |
  Vote: I like it -6 Vote: I do not like it

All the best everyone. This time +100.

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

Based Kana Badge <3

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Missing Ai (┬┬﹏┬┬)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to solve ABCD for once in contest time. All the time I drop at C or B because of panic WA or TLE or whatever feeling is running in my head...

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

tourist gonna reach 4K finally!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

As a tester, I missed the opportunity to compete officially in a great round! I hope you enjoy it!

»
3 months ago, # |
  Vote: I like it +22 Vote: I do not like it

The idea of badges is incredibly cool. I believe it should be extended worldwide.

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

The badges looks so cool!!!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Just curious to know if someone submit the same code in div1 A and div2 C is there a chance to get both his contests skipped.. like is the checker gonna check all codes from both the round together and search plagiarism or check the rounds individually?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    you can not give div1 if you are less than 1900, and you cant give div2 if you are rated more than 1900 if both happens at the same time, thus you can't give them together

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

I'm hopeful this contest will be both fascinating and enjoyable for everyone. Let's aim to boost our ratings and have a great time. Good luck, everyone!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

As a tester, the contest is the GREATEST round I have ever seen!

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    I really want to know why this comment is being downvoted

»
3 months ago, # |
Rev. 2   Vote: I like it +37 Vote: I do not like it

As a tester,I just realized that it's the one I've tested and my rating-boosting dream was rained(T_T)///GL&HF everyone,not bad probs

»
3 months ago, # |
  Vote: I like it +24 Vote: I do not like it

As a tester,I tested the round.

»
3 months ago, # |
  Vote: I like it +42 Vote: I do not like it

As the boyfriend of the girlfriend of the tester yuanruiqi, may you good luck & have fun!

»
3 months ago, # |
  Vote: I like it -35 Vote: I do not like it

qp orz

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It's been a long day without you, Codeforces!

lol

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

nice badges!!!!! :D

»
3 months ago, # |
  Vote: I like it +9 Vote: I do not like it

I love u wyrqwq

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Good luck & have fun!

»
3 months ago, # |
  Vote: I like it +24 Vote: I do not like it

My first Div1,let's go!!

»
3 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Hope it wont be bad for my first div1.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

These Badges look awesome. How to get them?

»
3 months ago, # |
  Vote: I like it +13 Vote: I do not like it

How can one find cool avatars like these for CP accounts? Also, I hope the badge exchange tradition can make its way to international events... Great additional incentive to try reaching them.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    Watch more stuff, I think. Anime is a wonderful realm to explore (sorta).

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You can also use the photo of yourself (no) You can also find some album covers (yes)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

The idea of badges is really cool!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

The badges idea is so cool!

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Wish to have a good problemset..

»
3 months ago, # |
  Vote: I like it +2 Vote: I do not like it

As not a tester, I hope to test it live

»
3 months ago, # |
Rev. 2   Vote: I like it +37 Vote: I do not like it

tourist just signed up... 3947 -> ?

Spoiler
»
3 months ago, # |
  Vote: I like it -42 Vote: I do not like it

I took part in NOI 2202, and Badge Exchanging was really impressive. Unluckily I got Iron Medal at that time. Now I'll reach LGM after the contest, which is very easy for me after -177.9 years of practice.

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Rooting for Tourist to 4000!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Will tourist have a 4000 rating this time?The fate is coming.

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

my classes end at 6pm, it'll take me 90-120 minutes to get home, I'm not missing this one, I'll make it!

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

let get pupil rank with this one! cuyu fighting!

»
3 months ago, # |
  Vote: I like it +10 Vote: I do not like it

hope tourist will reach 4k

...

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

I watch anime, too. Why can I reach the level as the authors TAT

»
3 months ago, # |
  Vote: I like it -13 Vote: I do not like it

is this contest rated ?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

as a participant, hoping to reach $$$1900$$$.

»
3 months ago, # |
Rev. 9   Vote: I like it +62 Vote: I do not like it

tourist winning this round is going to feel like Messi finally winning the world cup.

»
3 months ago, # |
  Vote: I like it +9 Vote: I do not like it

Mathforces incoming.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

wish to cross 1800

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

i am not able to register for the contest please help

»
3 months ago, # |
  Vote: I like it +10 Vote: I do not like it

The grandmaster who commented its going to be an extremely chinese round was right. This is basically math olympiad not programming contest.

»
3 months ago, # |
Rev. 2   Vote: I like it +4 Vote: I do not like it

first time ever I decide to unrate contest after registration by making no submission.

problem A is wow, just wow, what the f**k is that

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to join, where is late registration?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

:(

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

ARE U F KIDDING ME ????? WHAT DIV 2 A ????????

»
3 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

There is an option to unregister, can i unregister now?
I thought once the contest starts no action can be done regarding registration.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There is no "unregister" but if you register and don't make any submissions, it will be as if you did not register

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      When you go to contest page then in registered participants list, you will find the option but you can only unregister if you haven't made any submissions so far.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

A: Guessforces B: I'm dumb for not reading the statement right C: Pure arithmetic, not really algorithm really

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Naming convention for B sucks. l and r is really misleading... should have used l/u for lower/upper bound or something.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think it was intentionally named like that just so that people would go the wrong path of using segment tree lol.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      true I started doing diffrence array method to calculate max then read PS again after 2WA

»
3 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

jiangly has solved all before tourist :( so no 4000 for tourist

sorry tourist for commenting too soon

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I start hating cp because of this shit

and we all know that after testing not all cheaters are removed

»
3 months ago, # |
  Vote: I like it +21 Vote: I do not like it

he did it

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

tourist solved F!!!

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

Chinese rounds always shave off a few days of my lifespan, but I still keep participating in them

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

What a Contest tourist is ahead of jiangly by 5 points only

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Nice round. No long queues, no Cloudfares.

Most importantly, we witnessed HISTORY — 4000 rating for tourist!!

»
3 months ago, # |
  Vote: I like it +6 Vote: I do not like it

tourist has finally become the first person on cf to cross 4000 rating barrier

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it
»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

tourist 4000 rating !!!

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

Is C really that easy? 5k solves...

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Even DuongForeverAlone found it difficult, but a lot of newbie didn't , lol

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      The fact that I used $$$1$$$ hour in C before using the rest of the time for E, but no use. Come back to specialist soon.

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I will never do registered participation now onwards when the contest is Div1 + Div2 combined, author gets confused either it is Div1 problem or Div2.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      it is really just a normal div2 C but its using arithmetic not algorithms so he might not be good at it

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        Not really. My performance went down significantly this month and I got my chain of 2 -> 3 problems solved each contest (which is pretty low if I want to maintain 1k7 -> 1k8).

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    the problem A give away gcd idea. Hint is if you rephrase the problem into doing +-a or +- b for every c[i]. What's the min(max(c)-min(c))?

    After rephrase it you realize you can reduce a,b into just 1 number by taking their gcd. so the problem is +- gcd(a,b) now.

    Another hint is you should mod every c[i] for gcd(a,b). This is the pigeon intuition something(I dont remember lol, but the main idea is putting n pigeon into m closet. If (m<n) then 1 closet must have 2 pigeon.

    Then the rest is brute force over the sorted array O(n) times. Overall complexity is NlogN

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How can u do -a or -b?

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        every c[j]+=a (j!=i) and leave c[i] be. In that way you can see the delta is -a

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 9   Vote: I like it 0 Vote: I do not like it

      I solved it here basically its more like greedy idea,lets say n=2, u can make two number closest if their modulo by same number is also closer ,so sort array after taking modulo by gcd(a,b) then for every element in array from smallest to biggest you can always make it biggest number in array just by adding +gcd(a,b) to it and minimum will always be just next closest one on right .Note that this diff between both pairs of number will be least one from either be diff=(ai-ai+1) or gcd(a,b)+(diff)..*[ai<=ai+1]*,but in our problem we need ensure they are max and min in array so we choose gcd(a,b)+(diff) as a greedy approach on this sorted array

      278836498

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

orz tourist .. the legend has finally made it.. cheers

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Please tell me I'm not alone by being bamboozled in this div2A...

Cost 30 minutes for coding gcd and brute force and a lot of time on thinking about optimize just to realized you are being bamboozled (but after this I can solve C in the right path! So maybe not bad at all)

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Guessforces ;)

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it -7 Vote: I do not like it

      its just skill issue, not guessforces

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I used all of my mental strength on ABC and run out of juice for DEF... truly skill issue

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Was talking about A specifically

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      The proof is quite obvious though, because we know that the gcd of any two even numbers is not 1.

»
3 months ago, # |
  Vote: I like it +16 Vote: I do not like it

tourist orz...

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Poor Jiangly! Congratulations to the tourist with a rating of over 4000!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I was able to figure out the condition in Div1C/Div2F but couldn't think of how to implement it, Consider the set of elements in the subarray l to r, if we were to take the gcd of the consecutive differences of the elements in the set then the gcd must have a odd prime in its prime factorization, In this Case, the subarray is not brilliant.

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Got the idea maybe, We need to take difference of consecutive elements in the array and then use two pointers right?

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Basically, but you need to have a way to efficiently recalculate gcd when removing an element (segtree works, sparse table should work as well, there may be other ways), and make sure you don't screw something up if all of the numbers in a subarray are equal.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What?

    I reached that for $$$n=2$$$ an array can be brilliant if the difference between the two elements is a power of $$$2$$$

    Intuition :

    Let the number of elements between $$$a_1,a_2$$$ be $$$Z$$$, I choose the middle element, then half of the remaining elements on the left will be separated from the other half on the right of the chosen average.

    So I went from difference $$$Z$$$ to difference $$$(Z-1)/2$$$, and I should always be able do divide $$$Z-1$$$ by $$$2$$$, so $$$Z$$$ must be a power of $$$2$$$ minus one, so the initial difference must be a power of $$$2$$$

    $$$2^n$$$ does not have any odd prime O_O

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think he meant that the array is brilliant iff the gcd of differences doesn't have an odd prime factor (which is true for all subarrays that have at least 2 different elements; all numbers being the same is a special case).

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

tourist orz...

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Wow, tomorrow we will see tourist with 4000+ rating, first in the history of Codeforces!!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Solve div2D at 02:27:30... This contest is really tough for me.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

tourist orz

»
3 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Yet another "Found bug 30 seconds after the end" contest for me... The problems are great though.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Same, I found my error for Div2E 2 minutes after contest ended. If I had found my error 2 minutes earlier I would've likely gotten CM :(

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

can someone explain why this solution does not work for div2 problem D

https://mirror.codeforces.com/contest/2007/submission/278834900

isn't that all we need to do is determine if the root has a number? if it has, we only try to give numbers opposite to root's, else we can determine weather iris can give her turn to the opponent

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    If I understood your code correctly, your way of checking whether Iris can pass the turn (the (qm&1) bit) uses the number of all question marks instead of using only the number of question marks in vertices that aren't leaves or the root (playing in other question marks doesn't pass the turn).

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yes you understood correctly but before this operation i put qm -= lq + 1 i subtract question marked leaves and the root

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Whst if the root is not question marked?

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it +1 Vote: I do not like it

          If the root doesn't have a question mark, qm isn't used at all (in fact, this change only occurs if the root has a question mark), so it doesn't matter.

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        Oops, my bad. I'm pretty sure I actually caught the mistake now: ln + (lq/2) + (qm & 1) should actually be ln + ((lq+(qm & 1))/2). When you have an even number of leaves with question marks, it doesn't matter if Iris passes until Dora changes the root or if Iris changes the root herself, she can always change the same amount of leaves with question marks (lq/2).

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          ahh, i got ac with that

          when 6 seconds left i submitted with cout << ln + (lq/2) + (qm % 2 && lq != 0) << '\n'; but it didn't work. i guess i noticed the problem a bit late. thanks.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What was your thought process for realizing that Iris can "win" an extra leaf by "passing" turn to opponent sometimes?

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      actually one of the testcases forced me to realize that, i see if we play first, Dora can immediately give the same number.

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        Ah yeah, I got that pretest wrong and my mind blanked... I was so convinced that Iris could only score 1 even after drawing it on paper.

        I guess it is important to observe that the first move is "useless," so by moving first, you are actually at a disadvantage.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

how to solve d1C?

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    I couldn't submit solution because of a bug, but it looks like the condition is $$$GCD(|a[l + 1] - a[l]|, |a[l + 2] - a[l]|, ..., |a[r] - a[l]|)$$$ must be a power of $$$2$$$ (or $$$0$$$). It is the same as $$$GCD(| a[l + 1] - a[l] |, | a[l + 2] - a[l + 1] |, ..., | a[r] - a[r - 1] |)$$$ and then you need a sparse table to find these values fast for each left position $$$l$$$.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      wow, thats cool! can you plz explain why it works?

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Consider all possible values of $$$A[j] - A[i]$$$ on a segment and find their GCD $$$g$$$. If $$$g$$$ is $$$0$$$: all elements are the same, segment is good. If $$$g$$$ is a power of two you can just fill all the gaps between the numbers so that each of them is in the set. If $$$g$$$ has any prime divisor $$$p$$$ rather than $$$2$$$ -- all elements will have the same remainder modulo $$$p$$$. Since $$$p$$$ is odd, that means for all adjacent numbers in the set $$$x + y$$$ will never be divisible by $$$2$$$.

        And then you can just prove that GCD of all pair-wise differences can be found as the GCDs I've mentioned above.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You don't want to have $$$a[l]$$$ in there: if your subarray was $$$[2, 8]$$$, this would give you gcd $$$2$$$, which is a power of $$$2$$$, yet the subarray isn't brilliant. Otherwise, yeah (also, you can use a segtree instead of a sparse table, but that doesn't matter).

»
3 months ago, # |
  Vote: I like it +16 Vote: I do not like it

great problems! sad that limitations in E are so high :( didn't have time to figure out how to improve $$$O(n \log^2 n)$$$ to $$$O(n \log n)$$$.

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it +10 Vote: I do not like it

    Same (i figured out while impelementing nlog&2 in last 15mins but no time to switch then? ), but nlog^2 passed in 1s

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      We had no way to make $$$\mathcal O(n\log^2 n)$$$ TLE under the 4s constraint, but IMO it is harder than the intended $$$\mathcal O(n\log n)$$$, so I think it is unnecessary.

      And it seems that $$$\mathcal O(n\log^2 n)$$$ solutions are just with 2 logs, it cannot be improved to 1log...? I don't know because I am not very good at data structures )

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        it can be improved though? I can keep a frequency array of dimension log instead of a segtree

        I think if you can't tle something (my code wasnt even that optimized and it passes in 1s), consider letting it pass freely. IMO its more fair this way

        Also if you have a template of segtree, nlog^2 is easier (atleast to me). nlogn needs additional ideas.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I had centroid + std::sets. TLE test 9. But I submitted at the last minute, maybe I would be able to optimize it if I had more time.

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Mine was super quick log^2

        Just a for loop + iterative segtree

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I guess I can replace an std::set with an iterative segtree too... Probably should've done that.

»
3 months ago, # |
Rev. 2   Vote: I like it +94 Vote: I do not like it

Smart-Select-20240831-020606-Chrome

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it
»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Was anyone able to pass HLD in Div1B?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it -8 Vote: I do not like it

    The intended solution wasn't HLD but simple segtree manipulation apparently :( I also tried HLD initially.

»
3 months ago, # |
  Vote: I like it +59 Vote: I do not like it

How is tourist that invincible?

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

how to solve C?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    the funny thing is that it has 5k AC

    it's not this easy to get all of this but thx to cheaters actually

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      It's about average div 2 C though :/

      Maybe get better?

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        bro, u haven't seen the number of submissions in the last 30 minutes for C & D

        and for sure I already solved it in the first hour, but seeing this is too annoying

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I agree, I just think it was nothing unusual compared to other contests. It's, like, the stable amount of cheaters, The Horde of Disgrace.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    First let's imagine you have only A, not A and B. Then you can fix the difference between values if it's not smaller than A. e.g. A = 5, values = 5, 10, you can make diff = 0. But if it's 5, 11, the lowest diff is 1.

    Second, now we have A and B. If you have A = 5, B = 10, then B is useless, because A * 2 = B... or, actually, because GCD(A, B) = A! So now we have a clue. If GCD is 1 (e.g. A = 5, B = 9), we can ALWAYS make a difference of 0!!

    The idea: calc gcd(A, B), then for every number get it's Value % GCD(A, B). Maximum of this array — minimum of this array is your answer... UNLESS...

    Let's say GCD is 7, and you have values 1, 6. But 1 + 7 = 8, and 8-6=2 is better than 6-1=5. So now you need to actually iterate the array of values % gcd(a,b) you got before to see if you can optimize the solution by adding to the values[i] your gcd. Though to understand this there were steps in between that I have missed in the explanation.

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

If no fst.Tourist will get the first 4000 rating. Congratulations.

»
3 months ago, # |
  Vote: I like it +24 Vote: I do not like it

The 4-th sample of D1A reduced it's difficulty a lot. Otherwise it's problem rating could increase by 100.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes! I debugged using that case. Maybe authors want to make A a bit friendly (?)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

This div means how to make people hate PS.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I've never experienced so much skill issue solving a div2A q.q

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Experience with GCD problems was required for the A, I think... and for the C as well... GCDforces.

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Funny thing is that I've immediately noticed bezout's identity on problem C but couldn't figure out that any 3 consecutive numbers, with the first one being odd, are coprimes (fro problem div2A) :/

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        How do you solve C with bezout's identity. I just know it means ax+by=gcd(a,b). For C I realized that eventually the difference between possible linear combinations of a, b with different positive x and y integers converged on gcd(a,b) if you sort all the unique values that were generated. So you get a difference array that will eventually [....,gcd(a,b),gcd(a,b),gcd(a,b),...,gcd(a,b)], just be gcd(a,b) at the end.

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it +1 Vote: I do not like it

          You actually used the theorem. It state's that gcd(a,b) is the minimum positive value we can get from a*x+b*y with x and y as integers. From what I understood of your comment it seems you just did not fully understand the theorem, and treated this as an unrelated observation. Sorry in advance for any misunderstanding.

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
          Rev. 3   Vote: I like it 0 Vote: I do not like it

          I will explain to you my solution for the div2C problem. The first step is to understand that, by using bezout's identity, we can add or subtract (by adding it to every element except one) a multiple of G := gcd(A, B) to the elements of array C. That means that we can shift backwards all elements of C so that C_i := C_i mod G. Sorting all elements (C_i mod G) and keeping them distict, it's a matter of asking if there is a prefix that is useful to shift forward by G (for example, if I had the elements 1 mod 5 and 4 mod 5, it would be useful to see the 1 mod 5 as a 6 mod 5, making the solution 6-4=2 instead of 4-1=3), which means finding the smallest [ C_i + G - C_(i + 1 mod N) ] mod G in O(N).

          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            bro just please tell how to get intuition of shift back thing or minus thing it's like the operation is plus how did you know that minus won't make any differ this is very hard to observe for me

            • »
              »
              »
              »
              »
              »
              »
              3 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Honestly, when I first read the problem I assumed that you could subtract, only after the contest ended I noticed you could only use addition lol. You could get the intuition for using subtraction by noticing that it would really be useful if you could subtract A and B, unlocking bezout’s identity, it’s just a matter of justifying why is it possible.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      C was great imo.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I got rekt in A just to have a better start at C, so maybe it's fair trade in div 2 after all

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

lost a ton of rating but atleast it went to good cause
Finally 4000 gonna be breached

»
3 months ago, # |
  Vote: I like it +11 Vote: I do not like it

Some very cool problems, thanks a lot to the organizers! :)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Passed the example of D 5min after contest ends...

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

f**k me and my understanding for B , dammnn

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

The little boy from Belarus on behalf of every little boy wearing his shirt. Tourist on a million backs, Tourist for a million flashbulbs.

Gennady Korotkevich aka Tourist becomes first ever competitive programmer to cross 4000 rating mark on Codeforces.

Greatest programmer to ever exist!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

A and C were uh, peculiar problems, but very well written and thought out.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hardest Div2A I've ever seen. 40min of thinking with 0 progress .. euler totient? integer sieve? how it is possible

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    (count of odd numbers)/2

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    I spent 30 minutes on brute force and gcd and random stuff... until 31st min just print odd_count//2 and submit

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    just brute force

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      that was my first approach and obviously didn't worked. take first one, remove, find first one that is coprime, remove, find last one that is coprime to first and second.

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hints for Div2 C?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone explain why I see this?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It's Chinese editorial. English editorial will be published soon (probably since the translations are done).

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I had the logic for D but my bad implementation trolled me :(

  • »
    »
    3 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    Yeah, kinda sad there's no in between in codeforces (it's not like it's really possible to implement such system in a good way though), I'd imagine a half-grade for the idea... but when you have one and can't implement it (because there's some case you are missing despite the fact it's working), you get nothing, it's heartbreaking.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i could implement it but 1 error in a part of the code cost me the wa in pretest 2

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        I edited my answer, I've meant exactly this. have this case:

        4
        5
        1 2
        2 3
        2 4
        2 5
        ?????
        6
        1 2
        2 3
        2 4
        2 5
        2 6
        ??????
        5
        1 2
        2 3
        3 4
        3 5
        ???01
        5
        1 2
        2 3
        2 4
        2 5
        ??00?
        
»
3 months ago, # |
Rev. 4   Vote: I like it +3 Vote: I do not like it

GOAT tourist !!Can someone tell me the rule that the problem score in div1 decreases with time?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I've spent a significant amount of time trying to solve Problem B , then I realized the problem I am trying to solve is not B.

How bad a problem statement can be? => This bad.

»
3 months ago, # |
  Vote: I like it +55 Vote: I do not like it

As a competition on Codeforces, I believe there are too many data structure problmes in this game. Both D1D and D1E require some data structures to maintain, and most of D1C's practices also require the use of data structures. These questions are not difficult in terms of thinking, but they require a lot of time to write code. I don't think this is in line with the style of most Codeforces competitions. At the same time, D1E allows the time complexity $$$O(n\log^2 n)$$$ approach to pass when there is an $$$O(n\log n)$$$ approach, as long as you write it well, but in reality, this approach is not difficult to think about, only requiring some template code to be combined and slightly modified. I think this game is more focused on testing code implementation ability rather than short-term thinking ability. If it is played under the IOI format, it may be a qualified game, but it is not suitable for Codeforces. Or, in other words, it pioneered a new style of codeforces div1 competition ;)

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    nvm

  • »
    »
    3 months ago, # ^ |
    Rev. 3   Vote: I like it +18 Vote: I do not like it

    D1D doesn't require a data structure other than prefix sum. My code for C and D was shorter than for A and B, with some thinking you don't need to use any data structures and the implementation is quite short for both C and D.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there any time limit set for two consecutive comments and more than 4?

" You can write no more than 4 comments in 60 minutes "

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Releasing Chinese editorial before the English one??

»
3 months ago, # |
  Vote: I like it +22 Vote: I do not like it

Maybe only me got FST on Div1, Ofast + unroll-loops maybe harmed me >< 278842172 278846221
During the round I got PT passed and PT=ST but I got WA-FST, very strange...

»
3 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Thank you, tourist, it was the best and most epic live broadcast of my life!

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    He was live? where? I mean on which platform?

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +6 Vote: I do not like it

      I meant my regular updating of the results table :D

»
3 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Too much math to be honest.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

mfw I'm 5 minutes away from AK div 2 ToT

»
3 months ago, # |
  Vote: I like it +17 Vote: I do not like it

Aug 30th: World tourist's day.

»
3 months ago, # |
  Vote: I like it +1167 Vote: I do not like it

nice

»
3 months ago, # |
  Vote: I like it +108 Vote: I do not like it

I think people are more excited on tourist reaching 4000, than tourist himself

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    For me it is, even if I drop 41 points in this contest.

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

MANNNNNN I got cooked so badly :( All because of Div. 2 A

»
3 months ago, # |
Rev. 2   Vote: I like it -11 Vote: I do not like it

One day I will be at top++ like tourist

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

history created.....

welcome to new world -> 4000+ tourist

»
3 months ago, # |
  Vote: I like it -24 Vote: I do not like it

The worst Div2 in the whole summer

»
3 months ago, # |
  Vote: I like it +30 Vote: I do not like it

My dream is lgm ✖️ My dream is Tourist ✔️

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

tourist became Tourist. What a moment. I was here. I was a part of this history.

»
3 months ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

The Tourist has passed Codeforces; he needs Codeforces 2☠️

»
3 months ago, # |
  Vote: I like it -14 Vote: I do not like it

I need RUSSIAN editorial at RUSSIAN website pleaseee

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

The contests was epic. I haven't seen such good problems in a very long time.

»
3 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Maybe it's better to update the post so that we can see his new color.

»
3 months ago, # |
  Vote: I like it -22 Vote: I do not like it

Why do Chinese authors like multiple test cases so much? It almost reminds me of the days when I worked on HDU problems all day

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    It has nothing to do with Chinese authors, pretty much every CF rounds uses them a lot. Making strong test cases without the multiple test cases per file can often be very hard, so people use $$$10^4$$$ test cases per file to put every small case in one file to catch WAs a lot more easily.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +29 Vote: I do not like it

      Currently, it is a rule of CF that you must use multi-tests unless it affects the time complexity.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      Thanks for your explanation, that's my ignorance.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Guess difficulty

Div2A — 800

Div2B — 1000

Div2C — 1400

Div2D/Div1A — 1800

Div2E/Div1B — 2200

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

LIE

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I know Day Zero Tips is code