mr_practice001's blog

By mr_practice001, history, 3 years ago, In English

How you Doin'?

CodeChef NSUT Chapter is proud to invite you to C.O.D.E.R.S, which takes place on Monday, November 29 at 20:00(IST). The contest is rated for Div. 2 & Div. 3 participants.

C-O-D-E-R-S-2

Each division has six problems to solve in a duration of three hours. We have tried our best to keep the problem statements interesting yet short. And, YES! the theme of the contest is F.R.I.E.N.D.S, could it BE any more exciting?

Joining me on the organising panel are:

Good luck to all the participants!

UPDATE: Contest is postponed by one hour due to technical glitch.

UPDATE: Really sorry for the inconvenience. We did not intend this to happen. Due to various contests lined up in the coming days, we have decided to organise this contest on Monday, November 29. Coincidentally, it is my birthday too. :)

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

| Write comment?
»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it

As a tester, I can confirm that the problems are pretty nice! I would recommend participating in this round and enjoying the problems.

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

As a setter, I wish you solve all problems read all statements and watch a few episodes after the contest.

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

As an indian i would have liked nothing more than picture of legend jethalal in place of friends but ok

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

CodeChef's domain name has been expired...

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

    Working fine now!

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

      Working now !!

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

        Not working this side !

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

          Working for me.

          Check if your browser is caching the old page. If not, its probably provider level caching that hasn't been flushed since the issue was fixed.

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

          Press ctrl + shift + delete and delete last 3 to 4 hours cache you will be able to access CodeChef.

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

            I tried clearing cache, but still same issue. Hoping it will get resolved before the contest starts.

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

              Maybe try using a different browser

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

                still not working on safari

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

                  I have been using firefox, maybe try that, idk what to do if that also doesnt work

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

          If it does not work for anyone, please hard refresh once, and it should work. Ctrl+Shift+R.

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

            Still Not working :(

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

              I have started downloading Firefox,let's see what happens

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

                Not working on firefox as well for me

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

                  now working on chrome suddenly,check

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

                  Not working for me even after clearing all the cache from the browser

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

            Hard refreshed, cleared cache.. Still not working!!

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

    It seems that it's fine now for me!

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

Just me or are problems not loading?

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

Why are problems not loading?

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

Now where are the problems?????

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

1hour delayed?

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

wait!! no one told that we need to question and answer by ourselves?? Edit: just now seen the announcement

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

see this...

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

Since the timer still shows 2 hours and some minutes remaining, are we to assume that the contest will start at 9PM IST and end at 11PM IST?

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

    No, the duration would still be 3 hours. It would be 9PM — 12AM IST.

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

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

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

Hope it doesn't turns out that A few were able to see problem at 8:00 PM and are solving them now , ( as this has happened several times , earlier)

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

    I can ensure, that did not happen.

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

    "several times"

    Its happened once if I recall correctly? During the February Lunchtime this year. Unless you're counting the Div3 and Div1 problemsets being swapped for the first 5 mins of this year's June Lunchtime, I can't think of another occurrence.

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

      I can recall 2 occurences , ( Don't remember when they happened ) , once even I was able to see the problems.

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

What happening in the round on the contest page time of contest is start but outside it shows that 1 hour is remaining to start the contest.

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

This is why i <3 codechef

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

I am facing this problem. How can I get rid of this problem?

"This domain name expired on 2021-11-24 09:12:07 Click here to renew it."

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

Well.. Whatever, its just 1 more day :)

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

    Yeah… But now it overlaps with a CF Div 3 :(

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

      I know, that was sarcasm, and most of the people will probably give CF Div3 tomorrow, i think authors should consider rescheduling the contest.

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

        And they have moved it, I see. All good!

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

1 day delay ??

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

    Who will leave a codeforces contest for codechef XD

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

      I prefer codeforces at least for div3 people. casue of plag issue in codechef (:
      But i believe codechef will change their time :|

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

    Now it is showing delayed by 4 days 22 hours...

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

Ah shit, here we go again

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

Contest delayed to tomorrow.

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

now it clashes with div3 :(

UPD: they decided to postpone it to Monday so no clash :)

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

Man i hate codechef!

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

Vintage Codechef!

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

Downvoted the post !!

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

clashes with the div3 round now

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

In which imagination are you thinking that people will skip tomorrow's codeforces div-3 and give this contest?

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

Now there will be a clash between Codeforces Div 3 and this contest. mr_practice001, please reschedule the contest so that there is no clash with other contests.

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

I think most of the people would give the div 3 cf tomorrow, can you make the contest earlier so it ends before the div 3 round?

Update: it's rescheduled to 29th Nov 8 pm :)

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

Long live codechef

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

chill guys i think the contest will most probably postponed . as testers and setters will participate in div 3 round too. isn't it mr_practice001

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

Brace for downvotes

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

And, YES! the theme of the contest is F.R.I.E.N.D.S, could it BE any more exciting? Ok :)

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

Timer: 0s Refreshes Timer: 23hrs 59mins 58secs Div-3: "So you've chosen death"

UPD:- postponed to 29th

CC:- "Crisis Has Been Averted"

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

From codechef: "We are postponing the contest to Monday, 29th November at 8pm. We sincerely apologize for the inconvenience caused."

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

I still doubt the date

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

We are postponing the contest to Monday, 29th November at 8 pm. We sincerely apologize for the inconvenience caused.

Some users are still facing issues accessing the website due to DNS cache issues at the ISP level or the browser level which are beyond our control.

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

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

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

That's fine. It is clear that the internet issue is out of your control.

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

Reminder 2: Contest starts in ~30 minutes.

Also, the ranklist is ACM type but you would be able to see the result for each test file.

»
3 years ago, # |
Rev. 5   Vote: I like it +12 Vote: I do not like it

How to solve They Get Back Together? I spent a long time implementing an $$$O(T \cdot \sqrt{N} \cdot log(N))$$$ idea but couldn't get it to work in the end.

Edit: I'm an idiot, got a far easier solution than what I was doing.

Also a few of the earlier problems had some ambiguity and / or really weak samples:

All the Candy — I spent 30 mins thinking I could rotate the array, not permute it, and this passes samples as well.

Ross Wedding — Flipping on $$$s_i = 1$$$ instead of $$$0$$$ passes samples.

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

    Similar to you I also wasted 20-30 mins in All the Candy problem thinking why rotating the array can't get proper answer (as well as got 1 WA so overall wasted 30-40 mins on simple problem) to realize that all possible ways means to permute as well :/
    And due to this my rank fall down by almost 20-30 (due to which I may miss 5 star)
    Other than that can you tell me how to solve "One where Joey dates Rachel" I thought of 4 state dp where 1st and 2nd state are index of string S,T and 3rd state 0,1 (for inserting at start) and 4th state 0,1 (for inserting at end) But didn't had time to try it.
    Edit: missed by 3 rating points :(, if Codechef removed some cheaters I would have become 5 star

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

      We can get the minimum answer by either:

      • Performing flips on $$$s$$$ to match it against some substring of $$$t$$$ and then appending the remaining characters.

      • Adding a single character to the start / end of $$$s$$$, using that to flip $$$s_1$$$ or $$$s_n$$$ respectively, performing the remaining flips to match it to some substring of $$$t$$$ and then appending the remaining characters.

      So we only have to try $$$4$$$ or $$$9$$$ strings (depending on implementation) against the substrings of $$$t$$$.

      Its a bit difficult to explain why this works, but the key part is that:

      • If we are trying to make a string match by flipping its optimal to fix all in $$$[1, i - 1]$$$ before $$$i$$$ since we'll otherwise have to move back across $$$i$$$ to fix it, undoing our fixing of the position.

      • So by appending vals at the start / end of $$$s$$$, we can only perform flips that affect the flipped state of $$$s_1$$$ or $$$s_n$$$ of the original string. So we only need to check with those $$$2$$$ positions flipped.

      Submission

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

        There is one solution using DP : dp[i][j][k][l] , i<=n, j<=m, k<=2, l<=2. i,j denotes first i characters of s and first j characters of t respectively, k denotes whether the ith character is flipped or not, and l denotes whether I can append character at the end or not.

        Now, if s[i] == t[j], then we can skip these two characters and check first i-1,j-1 char (In this case, k must be equal to 0 as we are not changing (i-1)th char and l must be equal to 0 because we cannot insert char in the middle now).

        If they are not equal then we can use the flip operation, but if I have only one char left in string s then we can insert char in the beginning and flip the two characters.

        One more condition: If l == 1, then there is a possibility that we can append t[j] to s or we can append reverse char of t[j] and then flip.

        Minimizing all these will give the minimum required answer.
        My code : https://www.codechef.com/viewsolution/54543364

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

      I missed it by 1 rating. I stand on 1999 :)

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

    Do you have any link for your T√N approach ? I was able to get AC in T√N Log(N) approach .
    I can't understand the part where you are calculating the sum of each diagonal in O(1) , In worst case there can be N diagonal , so shouldn't it be O(T*N).

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

How is the answer for "The One with All the Candy"(Div 2-B) for the following case 2 ?

1

4

0 1 0 1

The people at position 2 or 4 can start and pass that will take 1 second and then the game will be over. How is the answer for this case 2 ?

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

    Because it is allowed to rearrange the neighbours. I also missed this :(

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 7   Vote: I like it +30 Vote: I do not like it

      Where the fuck did they mention this? Why is there so much ambiguity in the problem statements ?

      Couldn't the setters have written this explicitly that it is allowed to rearrange the neighbours ? They didn't mention it clearly and there is no such case in the samples either where permuting the array will give a different result.

      This ruined the contest for me. I ran thousands of stress tests and wasted so much time on this :( .

      mr_practice001, jayeshaw, this contest is crappy as compared to the other recent codechef contests.

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

        All what was about rearranging was in the explanation of sample tc 2, I mean wtf they didn't mention it anywhere in the question itself, wasted 1.5hrs with 5WA

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

        Is it normal to expect participants to rely on sample cases' explanations for picking up crucial missing information in the problem (that reordering is possible)? Moreover, this was a rated contest! This is unfair. I also raised a problem statement clarification for this problem but got no reply. jayeshaw please look into this. If this was deliberately done, it was more of a April Fool's contest rather that a CP contest

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

          Indeed this was an April Fool's contest.

          I got -138 rating in this contest because of this issue. The lazy setters didn't even reply to your clarification request. This contest should be made unrated but that would be too much to expect from CodeChef.

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

    mr_practice001 , can you please have a look ?

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

      You can permute the order, not just rotate it.

      So choose the ordering as $$$[3, 4, 1, 2]$$$, then the game will go 3 -> 4 and then stop.

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

        They didn't mention it clearly and there is no such case in the samples either where permuting the array will give a different result.

        Shitty contest.

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

        Could you please tell me where its really mentioned that the neighbours can $$$\textbf{stand in any order}$$$ they want or something similar ?

        I don't mean to be rude, but even after getting the extra time because of the postponement of the contest, such mistakes dont feel cool !

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

          I agree it isn't clear at all, even I wasted 30 mins on that interpretation of the problem.

          I guess its supposed to be "Among all possible ways in which the $$$N$$$ neighbors start the game".

          But it really should have been something like "Among all possible orderings of the $$$N$$$ neighbors" or something similar like adding a note "You can reorder the neighbors however you want"

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

mr_practice001 I think the testcases of The One Where Joey Dates Rachel is weak. This AC solution is giving output as -1 for the testcase

1
3 4
000
0010

The answer should be 2

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

    Its definitely weak, my solution can perform incorrect flips when matching the first or last window but it gets AC.

    Consider a case like

    1
    6 7
    101010
    0010100
    

    My solution will print $$$2$$$ instead of $$$4$$$ because it will add match $$$s$$$ against $$$t[1, 6]$$$ while logically flipping $$$s_1$$$ on its own even though a character can't be inserted before it.

    Basically that (!j && !k) || n < m should be (!j || window_start > 0) && (!k || windowstart < m - n) instead.

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

How to solve The One Where No One is Ready

  • »
    »
    3 years ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it
    My approach

    Edit : As I said, there is indeed a cleaner solution explained below by ExplodingFreeze orz!! (Not tagging him)

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

      There is indeed an easier to implement construction. I feel its probably a bit harder to observe though.

      Note that a single operation can delete any substring $$$[l, r]$$$ of the string.

      Suppose our answer is going to use character $$$x$$$. We want to keep some subarrays of $$$x$$$ and delete all the remaining regions.

      If we take some contagious substring $$$[i, j]$$$ of $$$x$$$ we will have to delete $$$[1, i - 1]$$$ if $$$i \gt 1$$$ and $$$[j + 1, n]$$$ if $$$j \lt n$$$.

      Now what if we want to take $$$[p, q]$$$ along with $$$[i, j]$$$? (assume $$$j \lt p$$$)

      We already deleted $$$[1, i - 1]$$$ and $$$[j + 1, n]$$$ for the first subarray, we can now change the latter to $$$[j + 1, p - 1]$$$. Clearly this is non-empty since otherwise $$$[i, q]$$$ would have been a contiguous substring of $$$x$$$. Additionally, we will also have to delete $$$[q + 1, n]$$$ if $$$q \lt n$$$.

      Basically we can notice any contiguous substring $$$[i, j]$$$ of $$$x$$$ has cost $$$(i > 1) + (j < n)$$$ if it is picked first, and $$$(i > 1) + (j < n) - 1$$$ otherwise, so we can just rewrite the total cost as $$$1 + \sum ((i > 1) + (j < n) - 1)$$$ over the subarrays we take. Since the individual cost is always $$$0$$$ or $$$1$$$ (except for the case of an entire array when its $$$-1$$$ and we only take a single subarray anyway), it is optimal to just greedily take them in sorted order of length if the cost after adding it doesn't exceed $$$k$$$.

      Submission

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

CodeChef, be shameful please!

10 mins ago this contest ended in CodeChef. I don't know you will believe me or not, 6 peoples submitted exact same code (just template is different), but I know they will not get skipped.

But why? Why CodeChef don't skip same solution just as CodeForces do?

Yes I know comparing CodeChef with CodeForces is shit, you maybe 5* in CodeChef but in CodeForces, maybe be you are newbie, yes that's the level of CodeChef & a 5* Coder in CodeChef, LOL, we all know that, even recruiters also do. Even the people who do cheating they have no future, no interest for ICPC or IOI, they are the worst people in our community & may GOD punish them for it.

But the thing is, why CodeChef don't skip same solution? Why they are not worried about their reputation & give MOTHER FUC*ING cheaters chance to do cheating? Any reason? Any CodeChef admin/moderator here who can clear that?

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

Such a shitty contest!

Didn't expect such type of problems from NSUT!

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

weak test cases

what should be the answer for N = 1 case for problem https://www.codechef.com/problems/S07E09 ?

my code is getting accepted no matter what you print

https://www.codechef.com/viewsolution/54541718

https://www.codechef.com/viewsolution/54540214

https://www.codechef.com/viewsolution/54546806

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

    I think the case of N=1, shouldn't even be there cause if you have say a[0]=5, so you can't really pass the bowl and cannot even drop it, thus holding it infinitely. The only corner case acceptable should have been for N=1 and a[0]=0, and the answer to which would have being 0!

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

      yeah that makes sense.But if i am not wrong this case should have been explained in the question itself or maybe included in the sample test cases.Wasted a lot of time thinking what to do for N=1