KAN's blog

By KAN, 2 weeks ago, In English

Hi Codeforces!

On Dec/03/2024 09:25 (Moscow time) we will hold Codeforces Round 990 (Div. 1) and Codeforces Round 990 (Div. 2). Note the unusual starting time!

The harder problems of this round are based on the problems from the Final round of Yandex Cup 2024, Algorithms track, that will be held at the same time.

The problems are authored by elshiko, Flyce, MrLolthe1st, sokolow, stepanov.aa, TeaTime, Tikhon228, webmonster, 4qqqq with guest problems from myst-6, Vladithur, BledDest and me.

I'd like to thank daubi, Golovanov399, arbuzick, pperm, orz, AgafonovArtem, Qwerty1232, k1r1t0, Itsmylove1, Sofi_, and errorgorn for testing the problems, tourist for helping with the round, and MikeMirzayanov for the Polygon and Codeforces systems.

Because of official Yandex Cup Finals ends later than the round on Codeforces, the upsolving, solutions, and test cases will be closed until the end of the onsite contest, roughly 3 hours after the end of the Codeforces round. It is also forbidden to discuss the problems publicly until the end of the onsite round. Any comments here concerning the problems will be removed.

Good luck!

UPD: The contest has been delayed to make sure the online contest does not start earlier than the onsite one.

Congratulations to the winners!

Div. 1:

  1. jiangly
  2. hank55663
  3. noimi
  4. cxm1024
  5. Pyqe

Div. 2:

  1. RGB_ICPC8
  2. timer2024
  3. tietieAM
  4. ylzxxx7
  5. mion_sonozaki

UPD: You are free to discuss the problems now.

UPD: Editorial.

  • Vote: I like it
  • -182
  • Vote: I do not like it

»
2 weeks ago, # |
  Vote: I like it -77 Vote: I do not like it

first comment :D

»
2 weeks ago, # |
  Vote: I like it -95 Vote: I do not like it

As a spectator, I hope tourist becomes Tourist again.

»
2 weeks ago, # |
Rev. 5   Vote: I like it 0 Vote: I do not like it

How come the announcement is so short. At first I thought it's a blog. I think something missing....

After EDIT : What a mysterious contest without any information. like : score distribution, number of problems etc.

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

    something IS missing.... the score distribution, but not that short.
    that's mainly because there are only few testers, and there are not any words to describe more about the staffs, which could be veeerrryyy long. heres a example from rayan announcement:
    Dear TheScrasse for his dedicated coordination efforts and lots of discussions about the problems and rejecting a big chunk of our problems for Problem C. He also contributed some problems to the contest, one of which was selected by the team!

    hey why downvoting me, I don't mean that long description is bad! just explaining why the announcement is short :(

  • »
    »
    2 weeks ago, # ^ |
    Rev. 2   Vote: I like it +9 Vote: I do not like it

    well not everyone has time or energy to post things like :

    • A super greeting (sometimes in native language)

    • ORZing co-ordinator , particular problem setter with sweet words with unlimited adjectives and follow up stories

    • Group photo in restaurant with problem setters

    • Some even start donation movement

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

    It is KAN's style to annouce very short.

»
2 weeks ago, # |
  Vote: I like it -47 Vote: I do not like it

7AM contest? Thank you, next :p

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

    Weak

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

    There's no way you're complaining. For me, literally every single contest is either at 6AM or 7AM depending on daylight savings. Sometimes 8AM if it is daylight savings and delayed start, or 1-2AM for unusual start time. This one is 10PM.

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

      Looks like a fellow PST member! I sleep early on weekends so I can do codeforces contests at 6:35 AM during the winter. I'm honestly happy about this 10PM contest, I think its a better time than 6:35 AM.

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

        Yup! I much prefer this 10PM contest.

        • »
          »
          »
          »
          »
          2 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          bro needs a few more 2 am contests lol

          • »
            »
            »
            »
            »
            »
            2 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            yeah it's literally specifically 1am i bomb 10pm contests too clearly i need to be more sleep deprived

    • »
      »
      »
      2 weeks ago, # ^ |
      Rev. 2   Vote: I like it +54 Vote: I do not like it

      I don't really understand the "There's no way you're complaining". I definitely do not complain about the general situation, where median CF round is at 15:35 for me. I will definitely not be participating in any round starting at 7AM, so that timing is bad for me and my initial post didn't mean to say anything else than "I am not a functioning person at 7AM" in a humorous way. In particular I didn't mean to say that the decision is objectively bad cause I am aware people in other timezones exist, neither did I want to complain like "why are all cfs round so badly timed?", cause I am aware I am in a favorable timezone for the vast majority of contests. Sorry if I came off as entitled or something

      • »
        »
        »
        »
        13 days ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Bro just doesn't remember good old times when one had to wake up at 5AM (4AM in Central Europe) to take part in TopCoder SRM once a month. Sad...

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

      I once woke up at 2am to do a contest: https://codeforces.net/contest/2024

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Painful time, but I'll take what I get. At least this time I was able to go to sleep early so I wouldn't fall asleep while typing, and it was well worth it.

»
2 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

What will be the score distribution?

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

who are the finalist ?

»
2 weeks ago, # |
  Vote: I like it +150 Vote: I do not like it

Are finalists allowed to check the standings of the Codeforces contest during the round? (if not, how will this be enforced)?

Given that the Codeforces contest ends long before the final round ends, how is it ensured that discussion doesn't begin until after the final round ends?

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Best of Luck Benq

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

    Now that I read the announcement, why didn't they sync the contests' end times instead of start times? It's easier to control problems not getting leaked when contest is on-site.

»
2 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

will the rating changes for the edu contest will happen before this contest ?

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Does the color of your avatar always match your rating? lol

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

      YES ⁦^⁠_⁠^⁩

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

Please change the start time, I have a school!◑﹏◐

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

What happens if someone changes from Div 2 to Div 1 (or vice versa) in Edu 172?

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The round starts too early after the end of the hacking phase of this Educational round, so there may not be enough time to run system tests and update the ratings before the round. Also, even if it were possible, changing divisions requires re-registration and it would be chaotic to let people do that in such a short time.

    So yeah, my assumption is that people are assigned to divisions according to their current rating, and the result of the Educational round won't affect it.

»
2 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

When will we know the score distribution?

»
2 weeks ago, # |
  Vote: I like it -16 Vote: I do not like it

which is harder?div1 or div 2

»
2 weeks ago, # |
Rev. 2   Vote: I like it -10 Vote: I do not like it

what a problem !!!!

»
2 weeks ago, # |
  Vote: I like it +23 Vote: I do not like it

What's the score distribution??

»
2 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

arcane s2 is masterpiece

»
2 weeks ago, # |
  Vote: I like it +7 Vote: I do not like it

The contest is in less than an hour. When will the score distribution get released?

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

    In less than an hour. I think they're gatekeeping score distribution because it's an on-site contest too and they may have different rules in place regarding stuff like this.

»
2 weeks ago, # |
  Vote: I like it -8 Vote: I do not like it

What's the score distribution??

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

because of the School Sports Day,I can't take part in this round(in fact,at weekdays students can't use computers during the time in school

»
2 weeks ago, # |
  Vote: I like it +10 Vote: I do not like it

Why did contest get delayed?

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

The contest has been delayed, and we want to go to sleep

edit:wish i was sleeping

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

Did it just get postponed by 30 minutes?

»
2 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

One refresh costed me 20 minutes :(

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

hoping for +420 :)

»
2 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

The more the contest delayed, the higher chance we're gonna lose our rating >:

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

Goodluck to everyone

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

Where is the score distribution?

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

KAN dont be lazy, upload the score distribution for div2 atleast

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I am participating just to solve problem E. Hopefully there are at least 5 distinct problems :)

»
2 weeks ago, # |
  Vote: I like it -10 Vote: I do not like it

score distribution?

»
2 weeks ago, # |
  Vote: I like it +44 Vote: I do not like it

Speedforces again. :(

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

    Speedforce!!!Problem D-F is much more difficult than A-C,making it into speedforce...

»
2 weeks ago, # |
  Vote: I like it -13 Vote: I do not like it

I think good problems, thx to all

»
2 weeks ago, # |
  Vote: I like it +49 Vote: I do not like it

Please avoid discussing the problems in public, including but not limited to this blog, until 11:10 UTC.

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

2 hours is not enough at all, why not 2.5h or 3h???????? (for div.1)

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

    why not 4h??????????????????????????

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

    Trash round.

    • »
      »
      »
      13 days ago, # ^ |
        Vote: I like it -32 Vote: I do not like it

      How dare you to say such words about the round which was prepared with the help of the mighty tourist!

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

    True, having 2 hours in a Div.1 contest really feel like another speedforces round...

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

      Div1 CF rounds have been 2 hours long historically and still sometimes are. Speedforces isn't a time problem but a balanced difficulty distribution problem.

      • »
        »
        »
        »
        2 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I agree, that said, it would be nice if the round was a bit longer for slow solver like me (2.5h for example).

      • »
        »
        »
        »
        2 weeks ago, # ^ |
          Vote: I like it -10 Vote: I do not like it

        Lack of balanced problemset AND time makes it into speedforces round. More time can somewhat compensate for unbalanced problemset.

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

          No, speedforces is the problem that occurs when there are way too many problems with way too few solutions and the rest with way more, so even people high up on the scoreboard are ranked mostly based on solving time. Giving more time will only slightly increase the number of successful solutions of those too hard problems, but also increase the number of people who end up with all easier problems solved, so it'll most likely make speedforces even more extreme. It's like trying to solve your gambling debt problems by betting all you own.

          • »
            »
            »
            »
            »
            »
            2 weeks ago, # ^ |
              Vote: I like it -10 Vote: I do not like it

            "...so it'll most likely make speedforces even more extreme. It's like trying to solve your gambling debt problems by betting all you own." that doesn't make sense. In the end everyone who solved all easier problems would have a speedforces round (which wouldn't be more "speedforces" than without additional time), but those who solved one more hard problem would have more of a fair cf round experience (I mean being slow wouldn't punish them that hard). So I don't think giving more time would make it more speedforces.

            • »
              »
              »
              »
              »
              »
              »
              2 weeks ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Those very few who solved one more hard problem. When there's a massive jump in number of solutions, there's a reason for it and that reason isn't just lack of time. Also saying "it doesn't make sense" isn't an argument.

              • »
                »
                »
                »
                »
                »
                »
                »
                2 weeks ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                I think in this round, there was quite a lot of implementation, also for the harder problems. So time was really a decider if you could just program your idea in time for one of the harder problems.

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

                Even if the number of participants who solve one more hard problem is very few (which you don't know for sure) does it mean it is not worth giving more time? I don't see any harm of writing a 3 hour contest instead of 2 hour contest even if it helps like 20-30 people.

                Maybe for someone the reason is lack of time.

                Sorry, didn't mean to be rude.

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it -33 Vote: I do not like it

    Trash round.

»
2 weeks ago, # |
  Vote: I like it -18 Vote: I do not like it

D looked so easy but turned out to be super difficult for me.

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

Can someone share the onsite final ranking!

»
2 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

nvm //I assume systests will also only run afterwards?

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

-ve delta for solving a-d :(

»
2 weeks ago, # |
  Vote: I like it +30 Vote: I do not like it

too hard.

»
2 weeks ago, # |
  Vote: I like it +10 Vote: I do not like it

I think I've seen problem 1C before

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

What was the initial start time (before it was delayed)?

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

System testing is over, when can I submit?

Edit: Ok, I see, about 2.5 hours more

»
2 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

why where's an easy 1C with TOO HARD D&E&F :(

»
2 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

man,what can i say,haha,oi out

»
2 weeks ago, # |
  Vote: I like it +41 Vote: I do not like it

Hello everyone!

We're currently streaming the final round of the Yandex Cup Algorithm track.

During the broadcast, we're also discussing the final problems with the competition judge. Join the stream

We're discussing some problems in Russian, and some problems in English as well.

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

The difficulty difference of this contest is too big.

»
2 weeks ago, # |
  Vote: I like it +28 Vote: I do not like it

pls someone check on orzdevinwang, hope he will be ok

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

    He flew so close to the sun that his wings burned

»
2 weeks ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

...

»
2 weeks ago, # |
  Vote: I like it -9 Vote: I do not like it

Is this round rated?

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

    Yes,it's rated.

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

      OK, thanks. I was confused because I didn't know that the contest would be marked as unrated until the ratings have been calculated.

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

Was this contest rated, cuz it's showing in the unrated contests. If it was rated, then do we have to do something while registering to attempt the rated version?

»
2 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

It is 11:32 UTC, but the editorial didn't appear... So how div2F?

»
2 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

For DIV2 C I solved the problem in O(n), but I didn't see that the constraint wasO(n2) . Why was it O(n2) when someone can solve it in o(n)...

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

    may be for DP solution, Edit : and its not n^2 actually even DP solution is possible is O(n) ig

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

      Yeah I too solved using DP in O(n). Is there any solution for greedy + sorting as mentioned in the tags??

      • »
        »
        »
        »
        2 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        hint : consider we have some arrangement after swapping which would lead to optimum path, here from each column we can consider one value except for one column where we take both values in that column through this column we can shift from first row to second row, think abt it

»
2 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

Lesson learned: never ternary search on a series that had non-extrema duplicate... Costed me Div1C because of this newbie error.

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Could you elaborate?

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

    You also did a sweeping line algorithm and then tried ternary search with segment tree? That would have been my approach if I actually thought of it faster. What should have been used instead of ternary search? Or it the solution completely different?

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

      Instead of ternary search the series itself, binary search its difference (since that is monotonic) — you'd need the first element that the difference changes sign (equal to the position of the extrema).

      UPD: I think I made another fatal mistake... the difference is not monotonic.

    • »
      »
      »
      2 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Finally I found the correct idea, and it's not relevant to the OG ternary search.

      Instead of searching for the $$$y$$$ that would yield maxima for each $$$x$$$, we search for the actual answer instead. We see that to reach a specific answer, there will only be a range of $$$y$$$ supports that for the half "behind" (having x-coordinate lower than current $$$x$$$), and another range of $$$y$$$ supports that for the half "infront". If those two ranges intersect, then such answer is possible.

      Added with pooty's comment (though I didn't do the exact bruteforce they intended), the number of searches could be lowered enough to fit into TL.

      My submission (very sketchy): 294633915

      • »
        »
        »
        »
        2 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I did something very similar (and made the same mistake you did with the ternary search idea when I tried to upsolve lol), my solution (294702082) ended up running in $$$O(n \log^2 n)$$$

  • »
    »
    2 weeks ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    Can just do brute force, since the best answer can only increases as u move on one axis, so no need to check if its possible all the lower answers as you move (i assume your approach is similar to mine)

  • »
    »
    2 weeks ago, # ^ |
    Rev. 3   Vote: I like it -16 Vote: I do not like it

    Did you mean ternary search will not work on array like this 1 1 3 2 2?

    • »
      »
      »
      2 weeks ago, # ^ |
      Rev. 2   Vote: I like it +1 Vote: I do not like it

      I meant something like $$$1 \, 1 \, 3 \, 2 \, 2$$$. Your case is binary-searchable.

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

        Yes sorry I didn't pay attention well, for the case 1 1 1 1 1 3 2, If you tried ternary search it will give 1 instead of 3, thanks for let us know this mistake. And in case of duplicate non extrema value, find the position where the sign change with binary search can also be tricky as 0 can be considered positive or negative, what should we do in such situation?

        • »
          »
          »
          »
          »
          2 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Yikes, thinking again, I might screw up once again. The difference is not monotonic to binsearch.

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

            As in, if you found that a point where its possible get a minimum of k already, as you move along one of the axis, you just need to check if its possible to get a minimum of k+1, etc

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    me too.

»
2 weeks ago, # |
  Vote: I like it +81 Vote: I do not like it

Why is input validator for c set to 1e5? Trying to hack and it gives me

Validator 'validator.exe' returns exit code 3 [FAIL Integer parameter [name=n] equals to 200000, ... range [4, 100000] (test case 1, stdin, line 2)]
close
  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it +37 Vote: I do not like it

    There is no max test case aswell, checked with assert.

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it -46 Vote: I do not like it

    The correct limit is $$$10^5$$$. Somehow missed that when decreasing constraints.

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

how can we solve problem E?

i thought finding median of x and y would be enough but it seems i oversimplified the question

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

What is the solution for div. 1 C?

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    First let's binary search the answer, call this x.

    We'll check whether it's possible to obtain this answer by doing a sweep line on the x-axis. Now we need a data structure that supports quick point update, range query. Let's maintain 2 of them, $$$left$$$, and $$$right$$$, we'll add the points by their y-coordinates and whether they're on the left or the right of the current x position we're checking, add all the points such that it's x coordinates is at least equal to the current x to the right, else to the left. Now we can just binary search for the smallest y such that $$$left(-1e9. y)$$$ >= x, and $$$right(-1e9, y)$$$ >= x. After that, we can check if $$$left(y + 1, 1e9)$$$ is also at least x, same thing for right side, now we have our answer

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

      Thanks, I thought the question need some complex data structure or something like that and got completely stuck. Seems so easy now, thanks!

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

      Any good source to learn sweep line?

    • »
      »
      »
      2 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Does this pass comfortably within the TL? I believe the second binary search along with the data structure queries would make the overall complexity $$$n\log^3{n}$$$ right? If we use a segment tree with the walk on segment tree technique then it can be reduced to $$$n\log^2{n}$$$, which is what I tried to do, but got TLE on my first submission 294679397.

      After this, I tried removing #define int long long, then it passed but the runtime was 2999ms, which is very very close to the TL (294679509). I then tried the same thing in C++23 instead of C++17, that passed in 2499ms.

      This is probably because of segment tree having a high constant factor, but using segment tree also reduces the complexity from $$$n\log^3{n}$$$ to $$$n\log^2{n}$$$, whereas in a fenwick tree there isn't this concept of 'walking on segment tree' right (I might be wrong here but I haven't come across such a thing in fenwick trees)? So I'm guessing with fenwick tree this approach will be $$$n\log^3{n}$$$ but with a lower constant factor, which is comparable to what I have submitted.

      I'm aware that there is another approach where we can do something like two pointers instead of the second binary search to find $$$y$$$ which would further eliminate a $$$\log$$$ factor, but without that, what would be the best way to go about the binary search approach?

»
2 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

hello can anyone guys explain he's solution for problem D and big thank !!

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

can D1C/D2E be done with geometric median?

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

    would it even be practical? That would require big number arithmetic. And I don't know if the constant/time complexity for those won't be too large.

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I don't completely understand geometric median but I think it would provide incorrect results for the following testcase:

    0 0
    1 1
    2 2
    3 3
    4 4
    5 5
    ...
    0 0
    1 0
    0 1
    1 1
    
»
2 weeks ago, # |
  Vote: I like it +4 Vote: I do not like it

When Editorial?

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

Do you have a solution to the problem?

»
2 weeks ago, # |
  Vote: I like it +24 Vote: I do not like it

Problem "For the Emperor!" is very beautiful! GG to the author <3

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How to solve it (Div1 D), though? I tried some min cost max flow approach but couldn't figure out how to give a cost to the whole edge (and not to using a unit of an edge, as it is normally the case in min cost max flow).

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

      I created 3 nodes {s,in,out} for each SCC, which I explain below. Sorry it may not be very clear, but the general idea is to maximize the number of nodes "covered" by a path, which is done by having a cost of -1000 per covered vertex, and as a secondary objective, minimize the total number of paths that start with an original copy (by having a cost of 1 per path).

      So for example if at the end we find that the cost is -4997, it means we needed 3 original copies to reach 5 nodes (-1000 * 5 + 3).

      The edges for a SCC compressed into a node $$$U$$$:

      • $$$src \rightarrow U_s$$$ with capacity equal to the number of messengers in that SCC, and cost = 0. This node $$$s$$$ acts as a splitter to ensure we don't exceed the total number of messengers across the outgoing edges below.

      • $$$U_s \rightarrow U_{in}$$$ with capacity=cost=1. This is to minimize the number of paths that actually start at the vertex with an original copy of the plan (the required answer). We need at most one copy per SCC.

      • $$$U_s \rightarrow U_{out}$$$ with capacity = $$$\infty$$$ and cost = 0, this represents a path that starts at the vertex without an original copy, so we must've gotten the copy through some other path.
      • $$$U_{in} \rightarrow U_{out}$$$ with capacity 1 and cost of -1000. This will ensure we cover each vertex by exactly one path, given the small negative cost.
      • $$$U_{in} \rightarrow U_{out}$$$ with capacity = $$$\infty$$$ and cost = 0. This is to say any path can pass through this vertex if it needs to, but note that this is not "covering" the vertex. The previous edge with -1000 would be prioritized first, which would cover the vertex.
      • $$$U_{out} \rightarrow sink$$$ with capacity = $$$\infty$$$ and cost = 0. This indicates that we can end a path at any point.

      Finally the DAG edges between compressed SCC nodes ($$$U$$$, $$$V$$$) would be added between $$$U_{out} \rightarrow V_{in}$$$. You can check the addEdge calls in 294690574.

»
2 weeks ago, # |
  Vote: I like it +21 Vote: I do not like it

Div.1 F1 and Div.1 F2 are completely different problems. I don't understand why this kind of subtask is allowed in a cf contest.

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

Problem div2 E is very similar to 2016 USACO Platnium’s load balancing problem: https://usaco.org/index.php?page=viewproblem2&cpid=624. Just a cool observation.

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

https://codeforces.net/contest/2047/submission/294647087 can someone pls see what am i doing wrong , its coming wrong ans for 'hhmv', when i custom run it, its giving the correct output but in the codeforces tested result its coming wrong , i am new to cp in python, pls correct me where its wrong

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    python dictionaries are not ordered, so what might be happening is that you and the judge are going through the items of y in a different order. For the "hhmv" test case in particular your code fails if h is the first character being checked, the first if saves h as the element with minimum frequency, and the second if block does not run because repl1 = 'h' now, so h doesnt get saved as the element with maximum frequency, so at the end the wrong characters get replaced

    • »
      »
      »
      2 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Makes sense, and its an easy fix to make the minimal correct everytime, thank you so much for the help, much appreciated

»
2 weeks ago, # |
  Vote: I like it +21 Vote: I do not like it

I think 1C is too easy and 1D is too hard. Maybe adding one problem between 1C and 1D would be better?

»
2 weeks ago, # |
  Vote: I like it +13 Vote: I do not like it

Despite popular belief, I think this is an excellent contest because I gained quite a lot of rating. Luckily, I chose to solve E1 instead of D, since I noticed the points awarded is lower (so probably easier), and it paid off! Would like to see more contests of this sorts:)

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

Are there any tips about the problems in div2?

»
2 weeks ago, # |
  Vote: I like it +10 Vote: I do not like it

1E feels like a Div2C. I wonder why so few people solved it.

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

    I guess many of them were stuck in D. I personally think E1 and F1 are both much easier than D.

»
2 weeks ago, # |
  Vote: I like it +9 Vote: I do not like it

Editorial waiting room...

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

didn't participate in the contest, but I'm happy I managed to do a div2 D for the first time lol (without searching etc etc)

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

why this post is getting many dislikes ?

»
2 weeks ago, # |
  Vote: I like it +7 Vote: I do not like it

I don't understand why problems were oredred like this. In my opinion, F1 is much easier than D, and the gap between C and D is way too large. It may be better to put F1 (maybe also E1) between C and D, so that some participants could have something to do in the last hour, instead of wasting time on a much harder problem.

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

    The score distribution literally tells you that E1 and F1 are both easier than D...

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

rating of C question?

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

When do we have the tutorial?

»
2 weeks ago, # |
  Vote: I like it +15 Vote: I do not like it

Editorial when?

»
2 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Passed more than 1 day but no editorial is published yet.

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

When can I read the editorial?

»
13 days ago, # |
  Vote: I like it -29 Vote: I do not like it

Regarding the message received from codeforces team about my code matching, i have a proper justification for this. The other id is of my friend and both of us were together at the time of contest and thus both of us were discussing the approach and logic behind solving the problems. That is the reason behind our code significantly coinciding.

  • »
    »
    13 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    When you register for the round, the rules explicitly say: "The registration confirms that you: ... will not communicate with other participants, share ideas of solutions and hacks". So you've broken the rules anyway even if you've written the code yourself.

»
10 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Why had it got so many downvotes?