Блог пользователя mr_practice001

Автор mr_practice001, история, 3 года назад, По-английски

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. :)

  • Проголосовать: нравится
  • +71
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +31 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

CodeChef's domain name has been expired...

»
3 года назад, # |
  Проголосовать: нравится +22 Проголосовать: не нравится

Just me or are problems not loading?

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why are problems not loading?

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Now where are the problems?????

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

1hour delayed?

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +7 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

see this...

»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +12 Проголосовать: не нравится

    I can ensure, that did not happen.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    "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 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This is why i <3 codechef

»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

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

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

1 day delay ??

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Ah shit, here we go again

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Contest delayed to tomorrow.

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

now it clashes with div3 :(

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Man i hate codechef!

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Vintage Codechef!

»
3 года назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Downvoted the post !!

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

clashes with the div3 round now

»
3 года назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

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 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

Long live codechef

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

Brace for downvotes

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +20 Проголосовать: не нравится

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

UPD:- postponed to 29th

CC:- "Crisis Has Been Averted"

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

I still doubt the date

»
3 года назад, # |
  Проголосовать: нравится +20 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +30 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
Rev. 5   Проголосовать: нравится +12 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 6   Проголосовать: нравится +1 Проголосовать: не нравится

    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 года назад, # ^ |
      Rev. 2   Проголосовать: нравится +2 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится +1 Проголосовать: не нравится

        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 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # |
Rev. 3   Проголосовать: нравится +3 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

    • »
      »
      »
      3 года назад, # ^ |
      Rev. 7   Проголосовать: нравится +30 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится +22 Проголосовать: не нравится

        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 года назад, # ^ |
          Проголосовать: нравится +3 Проголосовать: не нравится

        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 года назад, # ^ |
          Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

          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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    mr_practice001 , can you please have a look ?

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      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 года назад, # ^ |
        Rev. 3   Проголосовать: нравится +31 Проголосовать: не нравится

        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 года назад, # ^ |
        Rev. 2   Проголосовать: нравится +29 Проголосовать: не нравится

        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 года назад, # ^ |
            Проголосовать: нравится +10 Проголосовать: не нравится

          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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve The One Where No One is Ready

  • »
    »
    3 года назад, # ^ |
    Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится
    My approach

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

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +3 Проголосовать: не нравится

      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 года назад, # |
Rev. 2   Проголосовать: нравится +9 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

Such a shitty contest!

Didn't expect such type of problems from NSUT!

»
3 года назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      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