Блог пользователя nishit.sharma

Автор nishit.sharma, история, 2 года назад, По-английски

Hello Codeforces !!

I, on behalf of the InfInITy Team, would like to invite you to take part in the 5th edition of IIIT Pune's flagship coding event InfInITy 2k21, a rated contest hosted by CodeChef IIITP Chapter, which will take place on Wednesday, December 22, 2021, at 20:00 ISTUTC+5.5. It is a 3 hr long contest.

The contest is Rated for Div. 2 and Div. 3 on Codechef, but Div. 1 coders are encouraged to participate unofficially as there are prizes for top participants in combined(Div. 1 + Div. 2) ranklist. We'd be offering you 8 problems in Div 2 and 7 problems in Div 3 with varying difficulties.

CASH PRIZES  :

  • Top 3 performers  (Div1 + Div 2 combined)  will be awarded cash prize of INR 10000, 7000 & 3000 respectively. Top performer of Div3 will be awarded INR 2000.
  • Top 2 Indian participants will be rewarded INR 4000 & 2000 respectively(for Div1 + Div2 participants).
  • Prizes worth INR 10000 specially for IIIT Pune students.

Contest Link : www.codechef.com/INFI2021
Contest Timing : 20:00 to 23:00 IST
Registration For Prizes : Infinity Website or Google Form

I would really like to thank:

For any queries contact: [email protected]
Editorials for all the questions will be posted shortly after the contest ends!.

Past problem sets for the event: 2020, 2019

I hope you will enjoy solving the problems. Please give your feedback on the problem set in the comments below, after the contest.

UPD: Congratulations to the winners.

Div 1 + 2:

  1. tourist

  2. Geothermal

  3. kal013

Div 3:

  1. hit6646

  2. taoran_chen

  3. piccacu

All editorials have been published on codechef discuss.

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

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

How do prizes for top 3 in "div1+2" work if the divisions have separate contests on CodeChef? Will the problems be identical so you can manually merge the rankings?

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

    Yes, div1 and div2 will have the same problems and the winners will be decided after merging the rank lists

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

what is meant by the top 2 Indian participants in : "Top 2 Indian participants will be rewarded INR 4000 & 2000 respectively."? because the questions will be different for div1/div2 from div3..

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

    The only prize for div 3 participants is the overall Div 3 winner. All other prizes are for Div1 + Div2 participants. Updated the blog as well. Apologies for the confusion.

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

Reminder: The contest begins in 10 minutes. Join Here

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

Cheating has been started, just look how fast number of successful submission is increasing for "Marbles" problem in div.3. Please do something about it.

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

    This part of the MARBLE problem statement was likely intended as a joke, but there's a grain of truth in every joke:

    "Sang-Woo is the more intelligent one between them, and he plans to win the game by cheating."

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

Nice problems. Thanks for the contest. :)

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

Too Hard For me to solve even B

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

5 seconds late to figure out the frustrating edge case of Ddakji. :(

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

    I think the solution to this problem has to have a greedy approach, and lots of things to do with GCD. or, Maybe I'm completely wrong.

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

      You are right. If there are only 1 positive or negative number, it would've made things a little trickier since they can't be reduced.

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

For problem hopscotch, it makes no sense why the answer for the first testcase of the sample is $$$0$$$. Do you think that $$$(0!)=0$$$? We can literally count $$$1$$$ way in the problem to assign things.

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

When will problems be available for practice?I need to check my code to the last problem which I missed submitting by a few seconds

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

It was a nice contest. But I really hated solving Dalgona Treat

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

I felt this contest to be on the tougher side. It would have been a very good Div1.5 round.

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

What will be the answer for Ddakji for the case {1, 2, -3}? Accepted codes show 2 which I cant seem to get to :(

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

That was a really nice problems.

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

Found the problems pretty interesting. I was only able to solve Marbles and Tug of War. Could you guys please discuss your solutions for Dalgona treat, Hopscotch and Ddakji?

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

    Hopscotch :

    Hint

    Dalgona Treat :

    Hint

    Ddakji :

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

    For hopscotch, u can use inclusion-exclusion. First find out the the common elements between the indices that are 0 and indices that are assigned. Now we want to calculate number of ways to permute such that exactly 0 elements match their positions.

    Now find the number of ways such that at least 0 elements match their positions. Then subtract the number of ways such that at least 1 element match their positions. Now the number of ways such that at least two elements match has been subtracted twice. So you add it. Similarily we just have to add for even numbers and subtract for odd numbers. Code

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

    I found Hopscotch problem to be very similar to E — Rook Path from the recent AtCoder ABC contest and this helped. Both problems are counting the number of ways to do something and both can be solved by a recursive DP.

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

I solved the problem Hopscotch using dp. If anyone is interested, you can refer to my submission:- Link:- https://www.codechef.com/viewsolution/55287667

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

    Please explain your approach

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

      What I did was that I separated the elements into two groups. Group 1:- contains those elements which don't have their mannequins and they are also not part of someone else's mannequin. Group 2:- Contains those elements which don't have their mannequins but are part of someone else's mannequin.

      For example for this testcase:- 3 6 1 0 0 0 Grp 1:-
      4 5(mannequin)
      4 5(element)

      Grp2:- 2(mannequin) 6(element)

      Now, let's say there are i elements in total who don't have their mannequins. And same elemets which belong to grp 1 and diff(i-same) elements which belong to group 2.->refer to my code .

      le's define dp[i][same]->answer in which there are i elements who dont have mannequins out of which same elements belong to grp1. now,we can make transitions like dp[i][same]=dp[i-1][same-2]*(same-1)(case in which an element of grp 1 is paired with an element of grp1 only)+dp[i-1[same-1]*(diff or (i-same))(case in which an element of grp 1 is paired with an element of grp2). There are some minor implementation details(for handling edge cases). You can refer to gfg blog finding derrangements using dp for better understanding. Link:- https://www.geeksforgeeks.org/count-derangements-permutation-such-that-no-element-appears-in-its-original-position/

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

I enjoyed the contest and problems, other than the prizes were not for top5. :'(

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

    Thats great to hear. With each passing year he contest is growing a lot. We will try to get in more sponsors, to offer even better range of prizes for our participants :)

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

I don't see rating changes for me, but there are other people in the rank list whose ratings are changed basically I see there are few people who are 3 stars but then rating on the right side is 2 stars.

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

    It happens when they are updating the ratings. Check after 40-50 minutes, everything will be correct.

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

Time limit for TUG OF WAR (TOW) was very tight. My solution without using decreasing stack didn't pass as it had vectors and maps even though my solution was correct, but when I optimized it with stack and removed a vector which kept track of removed elements of b and the suffix max vector, it passed.
I think Authors should have kept $$$ N,M <= 5e5 $$$ so that such solution's can easily pass
Tle
AC with decreasing stack

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

    I think the lesson here is more about unordered_maps being sometimes slower than sorting. Yes O(n) is better than O(n*log(n)) but there are big constants. And look at quick solutions ~0.30sec. They just sorted array of B. Even python solution with sorting B are getting accepted in 0.8sec

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

      I used unordered_map mentioned by neal in this blog which is optimized in case of many collisions
      And I never faced any issue of TLE when using this unordered_map as they are better than ordinary map

      And my point is that the main overhead was because of vectors that I used for keeping track of suffix maximum and the arr2 which stored the removed elements. And generally for a div2 problem C it should not be forced to use only one vector, they should allow to pass different implementations
      I maybe wrong but that's what I have observed from the time I started CP

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

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