Vladosiya's blog

By Vladosiya, history, 45 hours ago, translation, In English

Hello! Codeforces Round 966 (Div. 3) will start at Aug/13/2024 17:35 (Moscow time). You will be offered 6-8 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600 or higher, can register for the round unofficially.

The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of open hacks. After open hacks all accepted solutions will be rejudged on successful hacks.

You will be given 6-8 problems and 2 hours and 15 minutes to solve them.

Note that the penalty for the wrong submission in this round is 10 minutes.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Problems have been created and written by our team: myav, Gornak40, senjougaharin and Vladosiya.

We would like to thank:

  1. MikeMirzayanov for help with ideas and Polygon and Codeforces platforms.

  2. FairyWinx, TheScrasse, Be_dos for red testing.

  3. irkstepanov, Kirkon, ikrpprppp, Kaey, Bruteforceman for yellow testing.

  4. Vitaly503, FBI for purple testing.

  5. satyam343, vikram108 for blue testing.

  6. trgt26 for green testing.

Good luck!

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

»
45 hours ago, # |
  Vote: I like it +7 Vote: I do not like it
»
45 hours ago, # |
  Vote: I like it -38 Vote: I do not like it

only purple and yellow testing?

  • »
    »
    41 hour(s) ago, # ^ |
      Vote: I like it +28 Vote: I do not like it

    why dont u ask them if they need cheater testing

    • »
      »
      »
      22 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yeah cuz you want to cheat as a tester

  • »
    »
    41 hour(s) ago, # ^ |
      Vote: I like it +30 Vote: I do not like it

    yeah cuz they dont want cheaters like you testing

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

      change ur pfp back sir, keijo is too degenerate for u

  • »
    »
    39 hours ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    why would you want to test as a cheater

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

    you can go test a div 5

  • »
    »
    11 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    IoI will always be a dream for cheater's

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

      sorry idk the context but why's everyone calling @puupil a cheater? was he caught cheating or something?

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

        Some good people release E solution during the contest It had a bug that is used to hack all cheaters who copied (go to hack section and view hacked E you will se pattern in code)

        • »
          »
          »
          »
          »
          108 minutes ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          damn this is down bad

          how do you know he did that though, did someone post a blog?

          • »
            »
            »
            »
            »
            »
            68 minutes ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            No blogs posted it's just observation and those who know know (it is what it's is)

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

              oh you meant blatant racism, understood. thanks!

              • »
                »
                »
                »
                »
                »
                »
                »
                17 minutes ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Bro this is not racism see his hacked submission E ( Stop assuming things I told you observer if you can't understand this do some problem instead of commenting)

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  15 minutes ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  System testing is going on so view after that

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

                  i asked you how you knew about it and you said you just know about it, i guess it's a language barrier so i apologize, sorry.

                  i did check for his hack on E before commenting but didn't find any hack, maybe because of system testing.

»
44 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Me waiting to get a minus again lol .... I dont know why i underperform div 3 and div 4 . Anyways can some one tell me any practice method to master div 2 D , i hardly able to solve them within 3 hrs in practice session .

»
44 hours ago, # |
Rev. 4   Vote: I like it -13 Vote: I do not like it

Expect to solve at least 4

Hope to solve at least 5 and get 1250+ rating

UPD: Solved ABCDE

  • »
    »
    41 hour(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Good Luck

  • »
    »
    15 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    NOICE

    • »
      »
      »
      15 hours ago, # ^ |
      Rev. 2   Vote: I like it -8 Vote: I do not like it

      thx, I solved E with 10 mins left, which I'm really happy about.

      I tried upsolving F and I failed, so this is probably the best I could have done.

      I always seem to underperform Div.2 and Div.2+Div.1 and overperform Div.3 and Div.4

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

        Im glad to hear that you've done it:) Guess you would be really happy then.

        I was solving F for about 40 minutes, but it was hard in implementation + because of sleepiness (It was about 2 a.m. in my time). So I solved only ABCDE too.

        I guess both you and I could prepare Div2 and later by solving some Div2 problems from the problemset prior to the contest.

        GL to you for this one. Hope you could promote back to pupil!

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

          well i think in this round G is easier than F. during the contest i have no idea of how to solve F as greedy wont work and i was shocked when i saw most people use DP to solve...

  • »
    »
    15 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    NOICE, dude!

  • »
    »
    6 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    how so pro?

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

    congrats to solve ABCDE

»
44 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

I wish I can AK this round >_<

»
43 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Hopefully I will reach expert in this round... :)__

»
43 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I am waiting for the tester to comment on this blog.

»
43 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

More people created problems than tested them :O

»
42 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

hope to reach pupil in this contest :D

»
42 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

No one for testing CYAN :(

»
41 hour(s) ago, # |
  Vote: I like it +7 Vote: I do not like it

I hope this contest to be cheating free.

»
40 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

welcome a new -100 (¬_¬)

»
37 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Wish I can get Expert on this contest!

»
36 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

lol guys you probably need some more testers)

»
36 hours ago, # |
  Vote: I like it +26 Vote: I do not like it

contest no.2000!

»
35 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

don't know but the performance in div 2 is better than div 3, hope to reach expert in this div 3

  • »
    »
    34 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    same with me also may be i think more cheater in div 3 than div 2 because of hard question codeforces should find some permanent solution from this

»
33 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

hope for Asuna_Yuuki

»
33 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

As a participant, DangKhoizzzz orz__

»
32 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

OMG! Another Vladosiya round !

»
32 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

wapis blue banna hai mujhe.. (hopefully)

»
31 hour(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

Hoping to break the 1400 barrier and becoming specialist this contest! Wishing everyone goodluck!

»
30 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

2000th Contest! It seems that Goodbye 2024 can't be contest No.2024......

»
29 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

As a tester, I wish you would enjoy the contest

»
29 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I will full solve this round, ggez

»
29 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Satyam is definitely not blue testing, lmao

»
28 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

satyam343 should not be allowed to do BLUE testing.

He is fake blue, he is actually Red.

That's like Donald Trump representing Poor of America.

»
27 hours ago, # |
  Vote: I like it -11 Vote: I do not like it

It's better find another blue tester , satyam343 is actually red

»
26 hours ago, # |
  Vote: I like it +13 Vote: I do not like it

Contest #2000 on Codeforces! What a milestone

»
26 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to solve 5 problems today. Good luck everyone!

»
25 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope through this game, I can reach the Specialist

»
25 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to reach 1300+ rating in this round

»
25 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Here we go to Chess.com :D

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

Thousands of submissions for E in the last 20 minutes wow

»
23 hours ago, # |
  Vote: I like it -12 Vote: I do not like it

Great contest! Good problems for a div 3

»
23 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

why am I reading the comments instead of solving E o.O

I still have 20 minutes left

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

stuck at F for an hour :) . Also 600 submissions on F in last 12 minutes? Yeah seems legit

Great Contest though , enjoyed :)

»
22 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

Well this round feels like true Div 3.
Good balanced contest.

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice contest, but cheaters ruined it again

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I can't find any counter example for my submission in D : 276247102

  • »
    »
    21 hour(s) ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    6
    1 1 1 1 1 1
    LLRRLR

  • »
    »
    17 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Your code will be fine with the minimum change.

    Code

    276325664

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Whosoever tranlated the problem statement or created it, better don't please. E was awful like awful!

»
22 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Got H last minute, phew. Feeling a little bit lucky.

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Finally I solved 4 problems

»
22 hours ago, # |
  Vote: I like it +11 Vote: I do not like it

H : Ksyusha and the Loaded Set can be solved using the tricks introduced in problem G: Penacony from last Div 3 Round. I talk more about the trick and the data structures used in this video

Define $$$dp[x]$$$ to be the longest streak of missing numbers starting at $$$x$$$. If a number is present in the set, you set $$$dp[x]$$$ to $$$0$$$. Otherwise, $$$dp[x] = 1 + dp[x + 1]$$$. Hence, you can populate this DP right to left after reading the initial numbers.

To answer any query, you just need to find the first $$$x$$$ such that $$$dp[x] \geq k$$$.

When you add an element, you need to refresh the DP table to the left of $$$x$$$. You can iterate over each element, and check if $$$dp[i] > |x - i|$$$. If it is, you need to subtract $$$dp[x]$$$ from all such $$$i$$$. Finally, set $$$dp[x] = 0$$$.

When you remove an element, you again need to refresh the DP table to the left of $$$x$$$. You set $$$dp[x] = dp[x + 1]$$$. Then, for each element to the left, check if $$$x$$$ was a bottleneck for the streak, i.e, if $$$dp[i] == |x - i|$$$. If it is, you increment $$$dp[i]$$$ by $$$dp[x]$$$.

Code for $$$O(N^2)$$$.

Now, to optimize it to $$$\mathcal{O}(n \cdot log^2(n))$$$, we need to figure out how to refresh the DP table efficiently. First, notice that $$$dp$$$ values of missing streak would decrease by 1 each step until it falls to 0 and then it starts at a big number and keeps falling. Hence, in type 1 and type 2 queries, when we say that we need to refresh the DP table to the left, we only have to refresh the elements after the last $$$0$$$. Hence, we need a data structure that can efficiently :

  1. Find out the location of the last zero.
  2. Add a delta in a range.
  3. Query maxima

Sadly, no such data structures exist. But we faced this same issue in G: Penacony from last Div 3 Round. Notice that 0 is always a minima. Hence, we can binary search on the left, and keep discarding one half of the range if the minima of that range is 0. Hence, a lazy segment tree from Atcoder Library suffices, usage of which I have discussed in the video above.

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    On second thought, you don't even need to query min/max using Lazy segtree. The last $$$x$$$ where $$$dp[x] = 0$$$ would simply be determined by finding the upper bound of existing elements and looking to the left. Hence, you just need a segment tree to do range increments and range maxima. So overall time complexity becomes $$$O(N \cdot log(N))$$$.

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I used a segtree to maintain the longest missing segment on a range. You'll need to additionally store range length, longest missing prefix and suffix: 276231982. Finding the first missing segment of length $$$k$$$ corresponds to binary earching on a segtree, which atcoder library conveniently provides in $$$O(\log n)$$$.

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

      For me, I saw that we need to find the minimum number $$$x$$$ in the current set such that the difference between $$$x$$$ with its right element is strictly greater than $$$k$$$. The answer is $$$x + 1$$$. I used a segment tree with minimum query to find such $$$x$$$. 276290172

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Any hints on F?

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    DP

  • »
    »
    22 hours ago, # ^ |
    Rev. 3   Vote: I like it +1 Vote: I do not like it

    Calculate the costs of increasing a point by 1 in each rectangle for all n + m axes. It is min(dim(x), dim(y)) at each turn.

    Then do a simple dp iterating on 'i'th rectangle, solving for 'j' points and taking 'x' first axes from the 'i'th rectangle

    Submission for reference

    • »
      »
      »
      17 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Do you try to think of the problem first in a recursive way and then try to optimize it using DP, or you are able to think of the DP solution right away? If yes, how?

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

    For a given rectangle find the minimum number of cells to paint to achieve a gain of $$$t$$$ points. $$$t \leq k$$$. To compute this , you will paint cells in a way so that first $$$a$$$ rows are first $$$b$$$ columns are painted so that $$$a + b = t$$$. Note that minimum cells = $$$ n * b + m * a - a * b$$$ where $$$n$$$ is number of rows and $$$m$$$ is columns. After that this problem is similar to knapsack.

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

    Do DP

    with states taking the first i rectangles and getting atleast j points then check for minimum among all possibilities of taking x rows and y columns and reduce time by adding the check that $$$x+y \leq k$$$

    the number of operations performed is simply $$$x*b + y*a - x*y$$$

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Will greedy not work on F (greedily sort by a*b) ? Or if it works do we need to handle last rectangle case differently?

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    No, because k can be really small and you can have a big a*b, and a small a*b, but to get k, the smaller a*b can be completed in less moves.

    • »
      »
      »
      9 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you explain a little more please, still not clear to me. Thanks

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

        The person above didn't clearly explain their greedy strategy. There are many greedy variations that get WA, so if you have a concrete greedy strategy I can try to come up with a countercase.

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

          I always take the rectangle with smallest side (lets say a, b where a<b), now the cost of increasing points by 1 is a (Since I'll fill all the squares along the side a). Once I perform this operation my sides become a, b-1. I insert { min(a,b-1), max(a,b-1) } back in my multiset unless a and b both are zero.

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

            Input: $$$2 ~~ 9 \newline 4 ~~ 32 \newline 5 ~~ 7$$$

            Your output: $$$36$$$

            Correct output: $$$33$$$

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

F: Thought greedy at first, but sample proved otherwise. Realized K was extremely small, and it's obvious that the answer will be deterministic from pos, k. Then just DP on that, taking the smaller of the rows or columns when you decrement k for each rectangle.

Code
  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Can you pls check where am i going wrong in my implementation. Thanks!

    Code
»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Stuck on E since I could not figure the amount of times each point will be contained in a sub-square. But overall, really nice contest.

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I was 10 minute too late for submitting E... feelsbadman

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

Wow I mean solving ABCD as a newbie and still get a negative delta

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

This was a fun round! Got stuck on F for a long time, I wrote dp that stored the fewest moves required for the current rectangle index and current score, but one test case gave an incorrect answer and I couldn't figure out why: 276291118

  • »
    »
    21 hour(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Figured out the problem, I was getting 86 instead of 80, because I fixed the row and column sizes for every score for the rectangle. For example, for 2 points I would fill a 3x3 rectangle with 3+3 operations, when it could be colored with 3+2, since 3x3 becomes 3x2 after the first operation. Worked perfectly after accounting for this

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Why this code (https://mirror.codeforces.com/contest/2000/submission/276250584) for problem D failed on test case 7?
Any counter test case?

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Need to use long for prefix sum array

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

    You have declared prefixsum to be of type int, but with n = 2e5 and ai <= 1e5, prefixsum can exceed INT_MAX and cause an overflow.

    • »
      »
      »
      22 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yeah realised just now after seeing the failed test case, when i got 2 WA then i left the contest thinking if this is not correct then i cannot think another now, now i regret :(

      Just a silly mistake, how dumb i am :(

»
22 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

for G, l did binary search + dp approach and l am in doubt about the correctness, pls hack my solution if you can, thx! submission link

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you explain the first test case please .

  • »
    »
    22 hours ago, # ^ |
    Rev. 2   Vote: I like it +4 Vote: I do not like it

    I think g can be solved by dijkstra, it's a beautiful problem.

»
22 hours ago, # |
  Vote: I like it +13 Vote: I do not like it

Good contest, I just performed really badly cause I couldn't figure out some edge case on D :(

  • »
    »
    21 hour(s) ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Your solution is correct,but In this line of your code score += mult[i] * nums[i] both mult[i] and nums[i] are integer so their product is also integer,you should declare nums and mult by long long integer.

    • »
      »
      »
      19 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh my goodness, thank you!! For some reason I thought that 2e10 would fit in an integer data type but it doesn't. Thanks again! :)

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

my idea for F is
we can pick a greedily pick a rectangle whose one of the dimension is minimum across all $$$(ai, bi)$$$
suppose $$$ai$$$ is minimums we add $$$ai$$$ to our cost and and get 1 point and decrease other dimension by 1
$$$cost \ += \ ai$$$
$$$k \ -= \ 1$$$
$$$bi \ -= \ 1$$$
but it's giving 36 instead of 35 for last tc

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It is to be solved using knapsack.

  • »
    »
    21 hour(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Did you find how for last TC, 35 is the answer instead of 36?

    I tried similar approach where I tried to get 18 points by filling 6X2 and 8X3, or is there any simpler test case that shows that it can't be solved greedily?

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Please help me find out why submission 276251214 in C++17 (GCC 7-32) Runtime Error but same code submission in C++20 (GCC 13-64) Accepted?

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

    This line int j = rs.size()-1; is the issue when the string has no 'R' character, because rs.size() returns an unsigned type, you should cast it like this (int)rs.size()-1;

    I guess the the C++20 compiler helped you out on that

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

    .size() uses unsigned int so 0 — 1 will overflow
    276296054

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

I couldn't even understand sample test cases on problem F

wtf

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone please explain me the 6th sample testcase for problem F.

Sample input :

3 25 9 2 4 3 8 10

Sample Output : 80

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

    I didn't submit it because I was getting 86 here no matter how I tweaked. I cannot manually find a solution with 80 pixels too.

    Edit: Just figured it out. On the 8x10 tile you can score 7 for cost of 50 pixels like this: https://dl.unicontsoft.com/upload/pix/ss_problem_f.png

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

    Take 9 2 for cost of 18 and points equal to 11. Then 4 3 for a cost of 18+12=30 and points equal to 11+7=18. After that, every time add min(a,b) to the operation and points increase by 1. Also, subtract 1 from max(a,b) until points are greater than or equal to k.

    Though for this problem greedy will failed( i guess).

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

how did so many people solve ABCD wtf?

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

This contest was fun, I solved ABCD within around 1 hour, and I solved E with 10 minutes left. Hope to get 1250+ rating!

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Indeed it was fun, even I submit E 10 minutes later I still feel very enjoyable.

    Coding until the last minute

»
22 hours ago, # |
  Vote: I like it +16 Vote: I do not like it

Imagine D without the last case it would be so much fun pain

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Still a very great contest. Appreciated the problems with good enough difficulty. Thanks a lot to the authors and tester

»
22 hours ago, # |
  Vote: I like it +12 Vote: I do not like it

wow! so many people had the same idea for e! and the same code too!

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    its most likely cheaters, 5000 solved E in a div 3 isnt normal

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yeah, I was shocked by how many people solved E.

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I do think E have some dp trick or math trick, it should be a quick one for experienced players (but not me tho, E cost me 1.5hrs rofl)

    • »
      »
      »
      22 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      2d prefix sum :P

      • »
        »
        »
        »
        21 hour(s) ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        bruh I used brute force and got AC in 343 ms

      • »
        »
        »
        »
        21 hour(s) ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        yep it is, was clueless in the contest so I just brute force all the way and get the math formula (cost a lot of time for testing everything)

    • »
      »
      »
      21 hour(s) ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      2D differance array.

      • »
        »
        »
        »
        21 hour(s) ago, # ^ |
          Vote: I like it +2 Vote: I do not like it

        u can calculate weight of each cell by pure arithmetic

    • »
      »
      »
      21 hour(s) ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      idk how you did, but essentially for any cell, you can very easily calculate in how many subsquares its gonna appear, and if you just put all of that in an array and sort it in descending order, you can sort the heights in descending order as well, and then multiply biggest height with biggest multiplier, 2nd biggest with 2nd biggest etc..

      • »
        »
        »
        »
        21 hour(s) ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        can easily calculate in how many subsquares its gonna appear

        Any hints on how to calculate this? I was trying to derive a formula but failed ;-;

        • »
          »
          »
          »
          »
          21 hour(s) ago, # ^ |
          Rev. 3   Vote: I like it 0 Vote: I do not like it

          You can calculate how many subsquares will contain a cell by calculating the minimum and maximum possible x and y for the top left square of a subsquare of size k by k by that contains that cell . If you need more hints I can help you.

          • »
            »
            »
            »
            »
            »
            21 hour(s) ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            yes please, for topX = max(0, i-k+1) and topY = max(0, j-k+1) but not able to understand how to find bottom one

            • »
              »
              »
              »
              »
              »
              »
              21 hour(s) ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Both your minX and minY are correct. For the maxX and maxY, there are two things bounding it: i and j, and the distance from the edge of the grid. So maxX = min(i,n-k) and maxY = min(j,m-k).

          • »
            »
            »
            »
            »
            »
            21 hour(s) ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Ah yeah that does make sense. I think I have an idea on how to approach it now

            Thanks, I'll try solving it myself later.

        • »
          »
          »
          »
          »
          21 hour(s) ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          well you can see that in best case scenario it would be K*K, and in the worst case scenario(if its a corner cell) its 1*1. you can also see that the cell thats in the center always has the max possible multiplier, while the ones that are closer to the edges gradually decrease. consider that, and try to derive a formula from there

          • »
            »
            »
            »
            »
            »
            21 hour(s) ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Yep I noticed that while writing it down but couldn't generalize it, it's fine I think I'll sleep on it and try it later. Thanks for reply btw

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

          An alternate solution that I feel is simple is that if you take it to one dimension, in each row now its no longer a k sided square but a window of size k that moves along the array you can increment the starting positions of the windows and decrement their ends, so you can iterate over every cell, say its at index i, and if i + k < columns, then you can increment arr(i) and decrement arr(i+k), and if i + k == columns, then only increment arr(i) because you dont need to close off the window from the right (it will be after the array’s end), and after youre done you iterate over this array and calculate the prefix sum array, and this will make the values at each cell represent the number of windows that cover it Do this for a grid over all rows, then do this same thing but on a different grid over all columns, and then multiply the values in the corresponding cells, and this value represents how many K sided squares will cover this cell

      • »
        »
        »
        »
        10 hours ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I had this same idea but it felt too brute force (that it would not pass the time limit) so I didn’t try it.

        • »
          »
          »
          »
          »
          6 hours ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          n*m over all test cases is 2*10^5, so you can kinda see that they were aiming for an n*m solution

          • »
            »
            »
            »
            »
            »
            46 minutes ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            oh I did not notice that. Makes sense.

»
22 hours ago, # |
  Vote: I like it +13 Vote: I do not like it

Amazing contest! Problems were true Div3 rated.

Thanks a lot for the round myav Gornak40 senjougaharin Vladosiya and all testers!

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope to become specialist in this round but chances of drop are high too at 5k rank

  • »
    »
    21 hour(s) ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    Please add "By cheating" also in this comment lol.

    https://mirror.codeforces.com/contest/2000/submission/276270036 https://mirror.codeforces.com/contest/2000/submission/276291750

    Your last Div 2 's C was also copied from telegram/YT isnt ?

    • »
      »
      »
      20 hours ago, # ^ |
        Vote: I like it -14 Vote: I do not like it

      Nope it wasn't coz the code here is quite short. So similarities are natural. Additionally, the variables used are also directly picked from the question. If I copied from yt/telegram I would have solved till G. Nor would I have submitted this late.

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

        So you wanted me to make a dedicated blog ?

        btw you are atleast brave(or maybe stupid enough?) to cheat that casually and have your name , college name etc .

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

          Having my name, college name etc is enough of an evidence that I won't do anything that stupid on a website that's public and doesn't erase past records and shows your code to everyone. Although I can say look at my submission map, problems solved, submission time of codes etc, I won't and will try to be objective here.

          1. For small codes, we can't really figure out if someone has cheated because ideas are likely to be the same all over.
          1. You might notice a difference in coding style of both the links. Now consider the two possibilities here — assuming that I cheated, I could have done 2 things —

          a) Copy the code as it is. This clearly ain't the case because the two codes in the link you gave have different structures (the second being my signature style that might be verified by checking my previous submissions)

          b) So this brings us to the second case — I did minor changes (not the gpt ones like variable change). So I was smart enough to manually type the code in my coding structure but not smart enough to change the variables? Wouldn't I try to make them as different as possible from the original source I am copying from if I already took the burden of doing the hard part ie restructuring it? And about the similar variable names, as I said they are the standard ones I normally use (check some of my past subs like using cnt for count to save time) and the rest being picked from problem itself.

          1. The coding style of the code you shared seems radically different to mine (infact idk fs what ll means maybe coz I never had the need to use it) so in that case I wouldn't have removed it had I copied it from here since idk what it does and how removing it would effect my program (but would give you a benefit of doubt for this one since I can't prove that idk what ll is xD).

          Now with all due respect I'd request you to please reply a strong counter to it OBJECTIVELY without assumptions or in case you do have to make them, make it statistical enough to have a high probability of occurrence with (preferably) quoting data.

          Additionally, your profile is quite new, created just at the time you replied to my comment which hints at the sole purpose of replying to me as the purpose of its creation (maybe because you yourself are a cheater who is scared of being caught had you come from a real account? Maybe someone who actually copied from the source you mentioned?) But anyways I won't make wild assumptions like that but this but the part of you creating this account just for the purpose of making this comment is a fact as it can be cross checked from the time frames there above mentioned. Idk what's the intent behind it but fs there is something you are scared of for which you didn't reply with your real acc.

          Additionally, I'd take the part of you pointing out specifically at my profile picture and me mentioning the name of my college as a try to create pressure via blackmailing (cyberbully in simple words) so would henceforth request MikeMirzayanov to check it out (and also manually review my code and the one stated above to crosscheck and ask for further clarifications if needed).

          I do get people getting pissed off from cheating but there is a clear difference between asking for clarification politely and attacking someone directly with giving threats in response restorting to cyberbullying. Creating a fake account just for the purpose of doing so further adds suspicion for it being done for a malicious intent.

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

            That "infact idk fs what ll means maybe coz I never had the need to use it" is kinda sus though

            Are you saying that you don't know what "long long" is? You literally have a #define int long long in your code so you should know that #define ll long long also does the same thing, using a shorter name for the type

            • »
              »
              »
              »
              »
              »
              »
              17 hours ago, # ^ |
                Vote: I like it -12 Vote: I do not like it

              Actually I have been coding in a standard template since the start of my cp journey so always used int for long long (except in initial days when I worked in C). Not much idea about macros except how they work. And that other code used 2 different macros for long long so idk of that or how the two are different

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

                I have two questions for you:

                1. Why you used global array in 276291750 and 276236011 where as you mostly used vector (local vector) like you used in this 275625615?
                2. Why you delete some of your code from your template in Solution E?

                PS: I'm not accusing anything here; I'm just genuinely curious.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  15 hours ago, # ^ |
                  Rev. 4   Vote: I like it -13 Vote: I do not like it
                  1. Declaring an array locally may exceed the size limit since it is stored in a stack in C++. How did I know it is the particular case? By testing it and failing twice (mle is a pain to debug coz cph doesn't show any output. Nor codeium explains it in most cases)

                  PS — Using extensions like cph and codeium arent against the rules afaik.

                  In fact you might try giving it a shot yourself. If you use VS Code, just copy paste my code there and cut that array declaration part from the global scope and paste it in local scope. The program will likely crash. I do use local arrays but it isnt really a good practice to do so (i am just habituated) because it can lead to issues like this where your program just crashes abruptly and you might not be able to figure out why it went wrong.

                  1. Now coming to the deleted code part, well in one of the attempts of correcting the code when I was selecting to erase my code (the previously written code) parts of my template was also selected and got deleted. Yeah i could have done Ctrl+Z but there were like 5 mins on the clock, i was kinda panicked and then it clicked why the program might have crashed (global array issue. i knew this because it happened before once in one of the problems of binary search on answer recently of spoj called paul's conjecture) so i just started typing not caring of whats lost (some got auto generated my codeium, an extension installed on my vs code which sort of remembers your previous code and makes typing quick) and as you can see i made my submission in the last minute with 10 secs left on timer.

                  but why did i use a static array in the 1st place when i normally use a vector? well i use vectors most of the times but not all the times. you can say i sort of switch between arrays and vectors (favoring vectors more though xD) but i do use arrays in some cases like you might see my solution to B in this contest where i used an array instead of vector to store boolean values. And you cant say that code is copied because i even saw the solutions of various PCD channels and none used the particular approach which I used for B so it is in a way unique (not the best though)

                  EDIT — AND YES SINCE YOU BROUGHT IN THE ARRAY PART I NOTICED JUST NOW THAT ARRAYS ARE ALSO DECLARED DIFFERENTLY. IN THE LEAK CODE THE ARRAY IS DECLARED BY KEEPING A CONST CALLED M. THAT AINT THE STYLE I USE IF YOU LOOK AT MY OLD TEMPLATES I HAVE ALWAYS USED MINIMAL CONSTS ONLY FOR THINGS LIKE INF AND MOD. ALSO, THE VALUE OF DECLARING ARRAY IS DIFFERENT IN THE SOURCE COUDE IT IS 1E5+7 AND IN MINE IT IS 1000000 BECAUSE I (AND NATURALLY ANYONE UNLESS A SPECIAL CASE NORMALLY DECLARES ARRAYS IN POWERS OF 10). THAT SERVES AS ANOTHER TESTIMONIAL FOR THE ORGANIC NATURE OF MY CODE!!!

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Did anyone else use DSU for problem C lol?

  • »
    »
    6 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I didnt use but i realy thinking about dsu , but i realize that a div3 C must be something eazy

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

someone hack my F, its O(n * k^3) 276277213

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

During contest, in problem E, I could only see green and yellow cells in the test sample. Was it only my problem?

»
22 hours ago, # |
Rev. 3   Vote: I like it +39 Vote: I do not like it

Fun fact: among the 7 "trusted" participants who solved all the problems, almost half of them are being untrustworthy, rank 4,5,6 submitted the same code except that they changed the variable names.

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

    The 'trusted participant' thing is there to prevent alts conquering the scoreboard. It can't do anything against cheats.

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Don't know why the last sample of G is 2 for quite a while until I see During the phone call, you cannot ride the bus, but you can walk along any streets, make stops , or stay at home.

  • »
    »
    21 hour(s) ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Can u please reiterate what u said? if we start at t=2, 2nd and 4th city will have their timestamps as 3 and 5 resp and we have to attend phone call for duration 5-7, so how are we able to cross to 5th city in <= t0?

    I am sorry, I am dumb, I just saw that phone call is only for the duration 5-6. So we can wait at 4th city.

  • »
    »
    8 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you explain, why the sample testcase 1 answer is 0. I think we can wait upto 19 minutes and then take the bus route 1 — 5 which will cost 30 minutes, and we will arrive on 5 at 49 minutes ?

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

276274588 and 276288231 LMAOOO, how does this not get caught in plag checks?

Another one 276288851

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

Many submissions for problem F contain this strange block of code, and now they're receiving WA hacks.

Spoiler
»
22 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

why greedy dont works for F? If sort pairs {min(a,b), max(a, b)}, fill that smallest side, +1 point for smallest side, in moment that will be square and thats anyway easiest way to got +1 point

  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    This thing right?
  • »
    »
    22 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    must use dp

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

    explain please how to get 35 in last test case

    • »
      »
      »
      21 hour(s) ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      coloring all cells of 5 x 4 and 6 x 2 rectangles would give you 9 and 8 points costing you 20, 12 operations.

      now color one row of 8 x 3 rectangle, you get 1 point at a cost of 3 operations.

    • »
      »
      »
      21 hour(s) ago, # ^ |
        Vote: I like it +29 Vote: I do not like it

      Sure, here you go!

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

Hackforces

»
22 hours ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

About problem F,why so many people define the size of a three-dimensional array as 40*70*70276276544 276285014 276272465 276274621 276287283 276287474 276279626 276276752

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

    probably clueless cheaters

  • »
    »
    22 hours ago, # ^ |
    Rev. 2   Vote: I like it +6 Vote: I do not like it

    absolute cheating, i also tagged some submissions 4 comments above. Is it possible for someone else to see what hacks are being made by someone else during the hacking phase?

    • »
      »
      »
      21 hour(s) ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      i dont think so, but its fine, since all of the submissions will be tested on every successful hack later.

      • »
        »
        »
        »
        21 hour(s) ago, # ^ |
          Vote: I like it +5 Vote: I do not like it

        oh didnt know that , then its pretty cool :) fuck them cheaters

  • »
    »
    21 hour(s) ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    HACK ALL OF THEM!

  • »
    »
    21 hour(s) ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    276275956 this one also lmfao

»
22 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Enjoyed the Round!! Thanks

»
21 hour(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

Loved the round. Will be one of my fav cf rounds. Great algorithmic problems. Truly Loved it.

  • »
    »
    21 hour(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ABCDE is good, probably comeback for FGH tomorrow. There's so many positive comments on them I will try to upsolve them for 1-2 days.

»
21 hour(s) ago, # |
Rev. 3   Vote: I like it +13 Vote: I do not like it

Truly beautiful problem F. Spent the whole contest on it and could only upsolve it. It truly made my day, thank you myav, Gornak40, senjougaharin and Vladosiya!!

»
21 hour(s) ago, # |
  Vote: I like it -21 Vote: I do not like it

Hint for D:

Hint
»
21 hour(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

GOT wrong answer in problem A because the input included spaces!

I got a runtime error in Problem A of this contest because one of the test cases was "10 " (10 with a space). is this intended ?

I couldn't see how the problem description explains this?

but overall the contest was great!! would appreciate it if someone can clarify the situation with problem A

Thanks!

  • »
    »
    18 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It is not necessary intended, but in general you should write code that allows extra spaces, tabs, etc unless statement clearly states about exact gaps. I.e. "integers in lines are separated by a single space".

    The only reason tests are not always being checked on such formatting is because code that fails on them is usually bad code.

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

    When using input = sys.stdin.readline you always get an \n at the end. When using int() or .split() this gets dropped, but for strings it stays there. You can see this if you do print(list(input())).

    To avoid this you can just do: input = lambda: sys.stdin.readline().rstrip()

»
20 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Having the discussion stream start before the open hacking phase ends feels wrong. But I guess most people don't hack anyways.

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

Wasted 20mints in F implementing Binary Search :(

BTW problems were good tbh :p

»
20 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem C, States that the value of m<=10^5 and n<=10^5 and t<=10^4, the time limit is 2seconds, then how is the solution of O(t*m*n) being accepted??

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

    It is guaranteed that the sum of n across all test cases does not exceed 2⋅10^5 , and that the **sum of the lengths of all strings does not exceed 2⋅10^5** .

  • »
    »
    20 hours ago, # ^ |
      Vote: I like it -6 Vote: I do not like it

    Those'll get hacked. Just wait!

»
20 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

how to solve the problem E?

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

    The limits on N*M <= 200,000 means you can traverse the grid.

    Traversing the grid lets you calculate how many sub-rectangles would contain each position.

    Thus you assign the larges values to the position repeated most

»
20 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Where's the editorial.. why they have not uploded it yet :(

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

    Hacking phase is on for next 9 hours, Maybe thats why.

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

    I think it will be uploaded after hacking phase finishes.

»
19 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

https://mirror.codeforces.com/contest/2000/submission/276288423

Can anyone enlighten me as to why this doesn't work?

  • »
    »
    18 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Consider $$$n = m = 100$$$, and $$$k = n - 1$$$. This way not so many squares will fit in the rectangle, so for, say, $$$i, j = 50$$$ the count is incorrect.

    • »
      »
      »
      18 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      ah ok thanks sad i didnt see it during contest XD

»
19 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

any one solve problem F in greedy and priority ? I debugged according to this idea, but did not pass,and I just want to know whether this idea is legal ?

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

the statements of problems is not clear i take long time to understand it, and i miss some to get

  • »
    »
    15 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    seems like skill issue

    • »
      »
      »
      10 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      you talk too much while being a specialist

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

        while you talk too much for being skipped in epic div1+2

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

        Id rather be specialist, than cheat to expert. also how are you not ashamed to comment when you got skipped last contest?

»
17 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone explain me why this code for H is giving TLE.

For every segment which is not present in the array, I am storing its size and the index where the segment begins from. I am storing the best (minimum index) in an array and building a minimum query segment tree on it, and I am also storing all other indexes in a set corresponding to its segment size to handle the '-' and '+' queries later.

Next, for each '+ x' or '- x' query, I am updating the segment tree and the map according to the new segments formed and unformed. Here, I am doing insertions and deletions on sets whose complexity is O(logn) time. And for the '?' query, we need a segment of size atleast k and with minimum index, which I am finding using the segment tree, which should be O(logn).

So, the overall time complexity of my code should not be worse than O(nlogn + qlogn).

Sorry, if someone is going through my ridiculously chaotic code.

  • »
    »
    17 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Your create a $$$2 \cdot 10^6$$$ element vector for every test case, and there're $$$10^4$$$ cases, which are obviously too many.

    • »
      »
      »
      9 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks to point it out, can't believe I missed this.

  • »
    »
    73 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I came up with the same logic. Carelessly, not paying attention for the high constant factor. I tried the same logic with coordinate compression technique, and now waiting for the endless system testing and queue :<

»
13 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

In Problem E, why can the same code be Accepted in Java 21, but result in Time Limit Exceeded (TLE) in Java 8?

»
13 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

how solutions with O(n*k*100*100) passes in F?

»
10 hours ago, # |
  Vote: I like it +14 Vote: I do not like it
»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Why didn't I get a rating after this contest?

»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can E be solved when the constraints of n and m are order of 10^9 ?

  • »
    »
    9 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I believe atleast a traversal of N*m is required so, it wont really be possible in my opinion.

  • »
    »
    9 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I do believe it can be solved with some math magic... which will bring this E to at least G-H level (waiting for editorial to show us the math magic)

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

When will the ratings be published?

»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I solved 3 problems but why I don't have a rating? I'm a newbie.

»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm trying to upsolve the Problem D — Right Left Wrong. Problem is my submission 276359457 is giving TLE while a similar logic, but one using 1-based indexing is getting accepted and I'm unable to understand how. 276137058

Can someone please help me understanding why it might be the case.

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

    in your code, findRangeSum() is O(r — l + 1) for range [l, r] while the latter code uses prefix sum to provide O(1) lookup

»
8 hours ago, # |
Rev. 6   Vote: I like it +9 Vote: I do not like it

A not so elegant brute force solution also exists for problem G.

We can run a Dijkstra from the nth intersection (Using only bus service). After the Dijkstra calculates the minimum distance to all the intersections, we take those intersections which are at a distance <= (t0 - t2). This ensures that we are not using bus services during our phone call. From these selected intersections, we can run a multisource Dijkstra (This time we can only walk through the routes). We repeat the same process of selecting some specific nodes, and then run a third Dijkstra which corresponds to the bus route taken before the phone call.

My implementation breaks the above scenario into two cases. Case 1: We use the bus service first, then we walk along a route, and then we again use a bus service. Case 2: We use the bus service first, then we walk along a route. However a clever implementation won't require us to do so.

Link to Implementation: 276362277

»
8 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

can some pls tell me why my code for D fails?

276271810

»
8 hours ago, # |
  Vote: I like it 0 Vote: I do not like it
  • »
    »
    7 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For your B submission you put an if statement specifically for cases when n = 1 or n = 2, this is fine, but what's wrong is that you are putting it before you take the next input which is the array of passenger, so for example if the case were like this:

    2

    1

    1

    3

    3 1 2

    It should output "YES" for the first and "NO" for the second, but since the first have n = 1, you printed "YES" before actually taking the next 1, so for the second one you take that n = 1 (and printed "YES" again) when it should've been n = 3.

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

    Basically, you are outputting NO multiple times per test case. The 2nd for loop shouldn't run if already flag = 1 from 1st loop.

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

[deleted comment]

»
7 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Is this rated , if yes then why doesn't it shows on my profile btw this was my first contest . Does anyone know about this

  • »
    »
    7 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    it will take 10-12 hours more I guess because thats what happens in div 3 and div 4

»
7 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

See #4, #5, #6 in the official list:

276286062 276283663 276290958

276277048 276273889 276281919

The cheating is getting out of control, becoming too widespread, and taking the fun out of participating in these contests. Anyone found cheating should not just be skipped for that contest but be life banned from this platform. If that is too harsh, at the very least, put their rating to 0, and let them start again. The current system is too lenient and encourages cheating.

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

    Cheater detection phase is after the contest. Just wait a little and be patient.

    • »
      »
      »
      5 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Ok, thank you to explain.

    • »
      »
      »
      5 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i've started giving contests quite recently, and i was wondering, how much of an impact do the cheaters actually have on the ratings after the cheating detection phase is over? is it a huge difference? i don't expect more than 5% people to be cheating honestly so i'm not sure

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

    fr man, plus cp is supposed to be a wholesome sport where everyone encourages each other to get better, and cheaters aren't just ruining the sport they are making it toxic too. if i had a +1 rating every time i saw racist comments i'd be tourist lmao

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

Why do man people make comments about cheaters Who could explain that to me?Thanks!

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

    Because Codeforces had an enormous increase in cheating in the last few months, so much so that nowadays there are up to a few thousand cheaters per round. Also, some people are cheating all the way up to International Master.

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

I gave yesterday's div 3 contest but now I'm unable to see my submissions.

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

So happy. I will be blue after this contest

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

Just wandering about problem E if there is a better way of calculating how many times subsquares overlap in a cell that runs faster than O(n*m). Was thinking of simply calculating how many cells that are covered by x subsquares exist but I dont know if its possible. Also whats the name of this concept (wandering since Ive encountered similar problems on math competitions, and had to compute them by hand)

»
2 hours ago, # |
  Vote: I like it -7 Vote: I do not like it

I will be rank 1st and beat tourist and jiangly in this contest

»
113 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

why Time Limit Exceeded 276190376

  • »
    »
    100 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Since the testcases cant be seen just yet I would guess that it got TLE because you used unordered_map. It is generally faster than a regular map but worst case is worse. So somebody probably made a hack to exploit this fact. Read https://mirror.codeforces.com/blog/entry/62393 or just use the regular map

    • »
      »
      »
      57 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      thanks,i use unordered_map since i think regular map will sort(log(n)) and i dont need sort.however it TLE.

»
106 minutes ago, # |
  Vote: I like it +1 Vote: I do not like it

Sadly, I failed to write a good "key not in the map" check in C and got hacked, but during the upsolving, I came up with a rather elegant way of circumventing the failure: check out the code — I use a wrapper struct to define a default int value: 276398448.

  • »
    »
    104 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Kinda nuts it wasn't in a pretest, but hard to blame someone other than myself (my solution was hacked too). I think it's possible to just add 1E9 + 1 to received number.

  • »
    »
    92 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I mean a .find() function exists though...In C++20 there is also a .contains() function

    • »
      »
      »
      41 minute(s) ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      In this particular case it would be much less elegant and had to be put in several areas of code which would make it harder to comprehend.

      • »
        »
        »
        »
        24 minutes ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Uhhh, that I don't know, I used .find() and I don't think it's less "elegant" than writing a new wrapper struct or something

        This is that part of my code

        auto it = atos.find(a[i]);
        if (it != atos.end() && it->second != s[i]) {
            return false;
        }
        
        auto it2 = stoa.find(s[i]);
        if (it2 != stoa.end() && it2->second != a[i]) {
            return false;
        }
        
        atos[a[i]] = s[i];
        stoa[s[i]] = a[i];
        
»
77 minutes ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I participated in this contest and solved 1 problem and it was accepted during the contest, but it showing In queue in My submissions

  • »
    »
    9 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Because system is testing all the submission once again after the completion of hacking period.

»
1 minute ago, # |
  Vote: I like it 0 Vote: I do not like it

MY rating is not been updated?