74TrAkToR's blog

By 74TrAkToR, history, 2 years ago, translation, In English

Hello! Codeforces Round 954 (Div. 3) will start at Jun/23/2024 17:50 (Moscow time). You will be offered 7 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.

You will be given 7 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.

The tasks were created and prepared by 74TrAkToR. I would like to thank everyone who helped me a lot with round preparation.

Good luck!

UPD: Editorial

UPD: Video Editorial

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

| Write comment?
»
2 years ago, hide # |
 
Vote: I like it -14 Vote: I do not like it

OMG 74TrAkToR!!!!

»
2 years ago, hide # |
 
Vote: I like it +66 Vote: I do not like it

»
2 years ago, hide # |
← Rev. 3  
Vote: I like it +19 Vote: I do not like it

Are you sure this is Codeforces?

It might be:

  1. Mathforces

  2. Algoforces

  3. Codeforces

  4. Interactiveforces

The question asks you to upvote and answer :D

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

Why everyone disrespects him, everyone made mistakes before. Just enjoy round!

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

Div.3 begin, 74TrAkToR's back, enjoy the trip.

:)

»
2 years ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

OMG! Another 74TrAkToR Round ..

»
2 years ago, hide # |
 
Vote: I like it -23 Vote: I do not like it

I feel this blog will be the most downvoted blog in codeforces history.

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it +43 Vote: I do not like it

74TrAkToR has to increase his contribution. Good luck !!!

»
2 years ago, hide # |
 
Vote: I like it +63 Vote: I do not like it

Looking at your contribution value, I don't want this round.

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it -19 Vote: I do not like it

Sorry Guys

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

Competition will return

»
2 years ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

rated div-3 after 255 days)

»
2 years ago, hide # |
 
Vote: I like it +18 Vote: I do not like it

I hope you have a wonderful round

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it +6 Vote: I do not like it
meme
»
2 years ago, hide # |
 
Vote: I like it +38 Vote: I do not like it

I believe 74TrAkToR will bring us a wonderful Div3 this time.

»
2 years ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

As a tester, I tested :)

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

  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it +16 Vote: I do not like it

    What's up with div1 + div2? I can't help, but notice that for some reason low-rated users participate in these contests less eagerly than in div3/div4/even div2

    • »
      »
      »
      2 years ago, hide # ^ |
       
      Vote: I like it +6 Vote: I do not like it

      As a CM, I can say that there is a notable difference in difficulty and performance between div2 and div 1+2. This would further exasperated if I could do rated Div3 and Div 4 like pupil/newbie. They just want to do the easier problemsets.

»
2 years ago, hide # |
 
Vote: I like it -12 Vote: I do not like it

int count = div_3_every_month;

if(count>=3) { cout<<" Helpful for Newbies , Pupils and specialist "<<endl; } else { cout<<"As it is now"<<endl; }

what do you think?

»
2 years ago, hide # |
 
Vote: I like it +43 Vote: I do not like it

Good Bye 2023!!

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

This is going to be the one for the books

»
2 years ago, hide # |
 
Vote: I like it +19 Vote: I do not like it

I think 74TrAkToR is one of the geniuses He is very good at writing problems and is very popular on this site

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

Have the ratings of previous rounds been re-judged? I don't know how my rating got decreased by 18 suddenly.

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

Hope to solve A

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

are there any hacking points for this contest?

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

    No, there are no points for hacking in contests with open hacks phase (usually educational, div 3, and div 4) as someone might create multiple accounts to hack themselves and gain points for this, but if you find a test case that can be used to hack a lot of solutions you can get a better place in the standings by hacking people above you.

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it +20 Vote: I do not like it

Finally I can write this.

as a tester, I can confirm that this contest will be a div 3

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

on the edge of being specialist

trust in 74TrAkToR round

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

hope to reach candidate master

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

I think we should let the bullets fly for a while, at least until we see the problems of this one :D

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

My cf id is not opening and handle is kxhitz. I had given last contest on 16th June 2024. Please check it out. Solve this issue as soon as possible so that i can continue my practice and participate in contests.

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

    Looks like it has been banned after the recent rollback, if you can prove that the solutions were your original ones and not cheated with anyone, then you can message the Coordinator of the last round to remove the ban otherwise it is gone forever.

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

      thanx for reply. I have messaged the coordinator of that round. Sir, how much time this would take as I have never copied anyone's code in any contest I had given till now.

      Is there anything else I should do ??

»
2 years ago, hide # |
 
Vote: I like it +125 Vote: I do not like it
this round is brought to you by...
»
2 years ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

as div3 enjoyer, i hope it will be a great round!

»
2 years ago, hide # |
 
Vote: I like it -43 Vote: I do not like it

Dreaming to achieve contribution as 74TrAkToR

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

Who's going to try to OEIS G tomorrow?

»
2 years ago, hide # |
 
Vote: I like it +26 Vote: I do not like it

damn i thought 74 is all history

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

Hope pref 2000+ Although 74 round

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

i have high respect for low contribution authors

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

Hope today is not speedforces.

»
2 years ago, hide # |
 
Vote: I like it +27 Vote: I do not like it

Delayforces...

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

Bro it's delayed!

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

what should we do in delayed time?

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

74TrAkToR is late...

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

Delayed cause everyone's watching F1

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

Delayed

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

delayed :)

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it +9 Vote: I do not like it

This is a delay in second 74TrAkToR's contest in a row

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

Delayforces :(

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

Is there ever going to be a div 3 round without delay?

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

The TrAkToR is going slowly so we have a delay.

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

thanks I just finished a heavy plate of pasta and I needed that 15 minutes

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

Everyone will try to become a pupil or specialist. I will try to submit before the cheaters

»
2 years ago, hide # |
 
Vote: I like it +91 Vote: I do not like it

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

Please, don't worry about delay, Mike asked for it to increase testing speed a little.

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

Traktor king lets go

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

What happened? why so much people know about the writer?

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

I thought that I missed the round start by one minute. But, it turned out that I have to wait for more than 10 minutes for the round start now!

Good luck to all, compete fairly and enjoy competitive computer programming.

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

Hope Goodbye 2024 will be super hard for B and above problems and only A is very easy if 74TraKtor Coordinates again.

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

good round, solved A,B,C

»
2 years ago, hide # |
 
Vote: I like it -12 Vote: I do not like it

I don't understand the author's intention to split $$$G$$$ into two tasks and not able to think of a specific algorithm to solve $$$G_1$$$.

»
2 years ago, hide # |
 
Vote: I like it -26 Vote: I do not like it

not-balanced round

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

Does D use meet-in-the-middle to solve? It seemed so easy but I couldn't solve it...

  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it +9 Vote: I do not like it

    it's just brute force on brute force

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

    first solve the following question: given an array of numbers, what is the minimum value of their expression?

    this is easy enough: multiply ones and zeroes, sum everything else.

    after solving this problem all you have to do is try it for all possible lists of numbers. notice that there are only $$$n - 1$$$ such lists

    the final complexity is $$$O(n^2)$$$

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

      I was thinking that approach, but it seems there are lots of cases to handle. For example, assume the digit is "abc0def". How do you decide whether to multiply c x 0, bc x 0, 0 x d, 0 x de, ..? We need exactly N-2 symbol. Probably 0xde leads to the most optimal one instead of 0xd.

      At the end I use DP.

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

        in this case you multiply everything by the zero, for example:

        $$$ab * c * 0 * d * e * f$$$

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

    Handle the edge case where result is 0. Which is pretty simple.

    Since you always have (n-2) signs, therefore theres always a 2 digit number(including 01-09) present in your calculation.

    The problem reduces to finding this 2 digit number then applying the following algorithm:

    Let i be the starting position of the 2 digit number. For each character from 0..i-1 and i+2..n, add if digit is not 1 otherwise multiply it and finally add the 2 digit number.

    Now to find that 2 digit number: You can iterate through all possible 2 digit numbers and add them to vector and sort it.

    Then among lowest 2 digit numbers that have the same digit in 1's place, pick the one that gives you the lowest result.

    You need to do this because sometimes picking the minimal number is not optimal, like 22 gives better result than 21 in one of the test cases.

    I couldn't come up with a better method to pick the minimum number so I kinda brute forced it. The time complexity is O(nlogn). (Picking optimal 2 digit number through sorting)

    Sorry if my description is kinda convoluted I am still learning

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

    Actually, you can brute force the element that will be combined with the right one and then try this: When there is 1 you multiply it, otherwise you sum it and write corner cases with zero, because you can multiply everything and make ans 0, but not in 101 and etc.

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

Really nice problems!

I found a bug in my bridges code due to problem F, thanks to problem authors!

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it -15 Vote: I do not like it

You must think you're humorous by choosing these questions. :D

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it -15 Vote: I do not like it

bye bye rating 💩

problem b were bit hard for it's position (second div3 problem), waste 30min to implement without ChagGPT, rating completely ruined

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

Thanks for the amazing contest 74TrAkToR !!! Finally a Div 3 contest that felt like a proper, balanced Div 3 contest <3

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

What was intended for G2? I used (almost) the same $$$O(n\sqrt{n}\log(n))$$$ code for G2 as G1 which doesn't seem like it should pass G2.

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

    I solved it in $$$O(nlogn + n*maxdivs(A))$$$ which $$$maxdivs(A)$$$ about $$$300$$$ i guess. The problem becomes for 2 simplified fractions, count the number of pairs of fractions $$$(x1/y1), (x2/y2)$$$ multiplied together to produce an integer. When fixing the denominator of the first fraction ($$$y1$$$) => the numerator of the second fraction must be divisible by the fixed denominator ($$$x2$$$ divisible by $$$y1$$$). => count the number of fractions with numerators $$$x2$$$ and $$$x1$$$ divisible by $$$y2$$$. Just brute all $$$y2$$$, processing $$$x1$$$ can be done before.

»
2 years ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

D and E are too much implementation heavy...

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

    what is the correct idea of E? I thought of try pairing every two elements from A so every element we can write it as follow : a[i]=x*k + a[j] for j != i

    but I didn't implement it

    is it correct?

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

      Let $$$x + kn = y$$$ ($$$n$$$ operations on $$$x$$$). This implies $$$y - x = kn$$$. This difference is divisible by $$$k$$$. Thus, two elements can only be made equal if they give the same remainder when divided by $$$k$$$ (if they don't, their difference is not a multiple of $$$k$$$).

      So we group elements with the same remainder modulo $$$k$$$.

      If there are $$$\geq 2$$$ groups with odd number of elements, it is impossible to construct a palindromic array.

      So, we move on to the case where you can apply operations.

      For each group, let its sorted list of elements be $$$a_1, a_2, \cdots, a_n$$$.

      For an even-sized group, $$$(\lvert a_2 - a_1 \rvert + \lvert a_4 - a_3 \rvert + \cdots + \lvert a_n - a_{n-1} \rvert )/k$$$ is the minimum score needed for that group.

      For an odd-sized group it's similar but a little bit more complicated. You will pair $$$2k_1$$$ elements in the front and add their score using the even group method. Then, an element will be left out to be the middle element of the palindrome. After that, the score for the remaining $$$2k_2$$$ elements will be added. The optimal left out element can be calculated using prefix sums.

      So you have the total score for each group, and you sum it over all the groups to get the final answer

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

First time get MLE in div3 round

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

For E, I wasted a lot of time on prefix/suffix sums to find the optimal element in the odd length array to put in the middle. Then, I realized I could use DP to do it without much thinking.

Code
»
2 years ago, hide # |
← Rev. 2  
Vote: I like it +14 Vote: I do not like it

solved F 3 minutes after contest finished...... :(

»
2 years ago, hide # |
 
Vote: I like it -24 Vote: I do not like it

I would die rather than to attempts traktors mathy and implementation heavy rounds

»
2 years ago, hide # |
 
Vote: I like it -25 Vote: I do not like it

L round

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

wrote recursive function to verify my observations in D and I found out that I can memoise my recursion function and convert it into dp.

»
2 years ago, hide # |
 
Vote: I like it -20 Vote: I do not like it

Skipping traktor's rounds from now on.

»
2 years ago, hide # |
 
Vote: I like it +58 Vote: I do not like it

who let him cook a template bridge problem???

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

    lol

  • »
    »
    2 years ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it +2 Vote: I do not like it

    For this kind of a standard problem there are not that many solves tho

    Although it does scream bridges the moment you look at it

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

    what is template bridge problem? easy to solve with concept from classical/standard problem?

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

      Take a look at this

      Additionally in today's problem you also have to come up with a way to calculate sizes of components after you remove a bridge (which is not too difficult)

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

    I copied the bridge search algorithm from an Internet site (the algorithm was published long before the start of the round) without rewriting it by hand and made some changes. I read the competition rules on the codeforces platform and still didn't understand if I could do this. I hope this question will be clarified to me.

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

    I pasted the statement into GPT4 and it gave a slow python DFS solution, then with one prompt I managed to get it to provide a correct solution (only had to fix an overflow bug).

    use c++, and do it in O(n) by storing subtree sizes and a bridge finding method was the prompt that allowed it to solve the problem!

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

I thought what could possibly change by just increasing the constraint by a mere 5 times in problem G, but it effectively thwarted my square root decomposition solution from G1, and I ended up having many MLE/TLEs :( .

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

div 2.74 (74 from 74TrAkToR)

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

why carrot giving error?

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

good round, thanks for the problems.

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

Task F can be said to be a learning task for finding bridges in a graph. I copied the bridge search algorithm from an Internet site (the algorithm was published long before the start of the round) without rewriting it by hand and made some changes. I read the competition rules on the codeforces platform and still didn't understand if I could do this. I hope this question will be clarified to me.

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

I'm not able to guess the complexity for my solution of G2, someone hack it. 267078205

»
2 years ago, hide # |
← Rev. 2  
Vote: I like it +18 Vote: I do not like it

Decent round tbh. Better than previous round by 74TrAkToR. Skill issued on implementing, but so did everyone else, I guess.

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

Here is my DP solution for D.

267043778

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

You can check my video editorials of D, E and F if you have any doubts

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

Silly mistake cost me E :(

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

Okay I'm fairly new to Codeforces, so I have no idea what hacking is. I had successfully solved A and B. But now sometime later after the round has ended, I open up the round page, B is highlighted in red, and after checking submissions I see that the verdict for B has changed to "Hacked"..... what.... why.......

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

I have a new version of c can anyone help me in that.
Update in 1986C - Update Queries, what if t was not allowed to sort the string c then how will approach. any suggestions.

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

    Here's what i thought about this:

    First lets store the distinct occurences of indices in increasing order along with its count. Now for an index $$$i$$$ in this array, we will try to place the smallest available character in $$$ith$$$ pos of $$$s$$$. The position of the chosen character in string $$$c$$$ should be such that we can place all other occurences of $$$i$$$ before it (since it only matter what we place last for an index $$$i$$$). For each character the best chance to be able to choose it would be if we choose the last available occurence of that character.

    So now what remains is how do we choose which characters would correspond to the leftover occurences ? It would be best to strike off the maximum characters to the left of the last occurance of the chosen character. We can simulate that using a segment tree.

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

      I was thinking of the same approach but the main difficulty I faced was like suppose for index 1 we have count of 4 and for index 2 we have count of 3.
      So, we have sorted t array something like this: 1 1 1 1 2 2 2 .........
      Now have to assign best character to last 1 such that there are at least 3 characters before it so that we can assign them to preceding 1. Now for 2 we need to remove max 3 characters that were assigned to 1 and the smallest characters then again go with 2.
      Can you tell how you will tackle this, if possible, provide the pseudo code and expected Time complexity.

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

I don't know why some people complains so much about this Round, it doesn't matter if it's all implementation or math, after all is a problem u need to solve, there are no excuses in real life problems, good Round admins!

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

Contest was great,but cloudfare spoil it for me

»
2 years ago, hide # |
 
Vote: I like it +65 Vote: I do not like it

Any reason we are using memory limit 128M instead of the default 256M for G?

I didn't see any reasons to reject solutions on the memory constant factor.

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

MLEFORCES

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

Can anyone explain why unordered_map solution is giving TLE, while map is working fine?

unordered map

map

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

      It is interesting that the post was made 6 years ago, yet lots of people (me including) dont know. Shouldnt they patch and prevent people using bugged version? Even though perfect implementation is crucial in CP, one shouldnt penalized due to buga from the compiler.

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

        This isn't a bug of the library or the compiler. C++ specification clearly states that unordered_map<K,V>::insert()'s time complexity is worst case O(N) (cppreference).

        If you are curious about how this happens, study the data structure of hash tables.

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

can someone explain why this fail for problem B https://codeforces.me/contest/1986/submission/267043411

  • »
    »
    2 years ago, hide # ^ |
    ← Rev. 4  
    Vote: I like it 0 Vote: I do not like it

    Your code fails if n=1 or m=1:

    if(i==0){
        if(j==0) {
    	if(mat[i][j] > max(mat[i][j+1], mat[i+1][j]))							 
                   mat[i][j] =max(mat[i][j+1], mat[i+1][j]);
    	}
    

    You look at positions (i,j+1) and (i+1,j) without checking if they exist. I don't recomend to write so many if-statements, because then it's very easy to make small mistakes like this. Example of my code without so many if-statements: 266984242.

»
2 years ago, hide # |
 
Vote: I like it +18 Vote: I do not like it

Surprised Pikachu

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

    Turns out test 43 is the first test where $$$n = 500000$$$, which is odd.

    Stress tests should be among the initial tests. Otherwise, it takes too long to get the verdict during a contest.

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

Can someone please explain that in E — Beautiful Array, for the input

13 3 2 3 9 14 17 10 22 20 18 30 1 4 28

How is the output 14? I re -checked multiple times and found it to be 15.

Please reply ASAP

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

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

Can someone explain why this solution failed as TLE?267007171 .I expected the Time complexity as O(nlogn+mlogm).

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

    I'm pretty sure that you are making it O(n^2) through string concatenation (basically, appending a char to a string of length n has time complexity of O(n) because strings in python are fixed-sized unlike C++ where they are almost a glorified vector)

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

      Thanks for your reply and pointing out the mistake, i think it would be a lot helpful to me in the future. Really appreciate it But still i got a question — why does this same code passes with Python3- 267178416 whereas the same code gets a TLE with PyPy3- 267007171

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

        I am not Python expert, I mostly do C++ and some Rust but my guess is that Python3 interpreter recognizes that you are building a string char by char and does some clever optimization on this code which allows it to avoid the O(n^2) pitfall somehow

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

I have sacrificed 'D' to score 'E'! It was a little heavy implementation (E).

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

unrated

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

    Unlikely, It's just that tests took quite a lot of time because there were a lot of hacks and that's the reason the whole thing kinda got shifted to later

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

unrated???

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

Is the round going to be unrated??? The ratings aren't updated after system testing

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

unrated :(

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

why unrated

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

    unrated for me too

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

      Until a contest is rated it will be displayed as unrated. Sometimes it can take more than 24hours to roll out ratings and sometimes they rerate contests too. Nothing to worry ratings will be out maximum by tomorrow. (P.S Don't mind if there are any spelling or grammatical errors)

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

Changing map to a sorted vector of elements + binary search works in G2, the time complexity is the same but i can't figure out why it removes the MLE i get with map, since intuitively, i am storing count in map and elements in vector, the storage in map is more sparse, is this happening because in testcase 43 the array values are such that, it leads to lower count values in map and thus, reducing the advantage of sparseness?

Map submission

Vector submission

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

So why does this code: link return a result of Runtime error? I was able to compile the sample locally.

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

i'm kinda new to contests in codeforces so i dont know if this was a hard contest or the other div 3 contests where too easy. i normally solve around 2 or 3 problems in div 3 contests but i could only solve problem A in this one.is that just a me problem ?

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

Was there some changes in the rating updation?

I had gotten +39 now I have +51 in this contest.

»
2 years ago, hide # |
← Rev. 3  
Vote: I like it 0 Vote: I do not like it

jiangly Can you please explain your solution for G1 and G2?

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

Good contest

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

.