tejas10p's blog

By tejas10p, history, 2 weeks ago, In English

We invite you to participate in CodeChef’s [Starters 44]((https://www.codechef.com/START44?utm_source=codeforces_blog&utm_medium=organic&utm_campaign=START44),, this Wednesday, 22nd June, rated for Div 2, 3 & 4 Coders.

Time: 8 PM — 11:00 PM IST

Joining us on the problem setting panel are: - Setters: Utkarsh Utkarsh.25dec Gupta, Lavish lavish315 Gupta,Jeevan Jyot JeevanJyot Singh,Ashish Kryptonix Gangwar,Ashish 7KIRA1999 Kumar

The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

Also, if you have some original and engaging problem ideas and are interested in them being used in CodeChef's contests, you can share them here.

Hope to see you participating. Good Luck!

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

»
13 days ago, # |
  Vote: I like it +8 Vote: I do not like it

Reminder: Contest starts in 15 minutes.

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

I am trying to solve NOPAL2 using the following logic,

  • First, sort all chars in desc order of their freq.
  • Assign the chars on the indices of the form $$$3x$$$, then assign on the indices of the form $$$3x + 1$$$ and finally assign on the indices of the form $$$3x + 2$$$.

For example, if the string is dbdccbaabaa, then sorted string will be aaaabbbccdd, so the construction will go like.. a__a__a__a_ -> ab_ab_ab_ac -> abcabdabdac

Can somebody point out what's wrong with my logic ? It's giving me WA on 5/15 cases.

Submission link.

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

    I did the same thing and my solution fails on the same test cases.
    Your code fails in this case 1 10 abcabcabcd.

    The editorialist’s solution fills in the order c3, c2 and c1 (3k+2, 3k+1, 3k). I don't quite understand the issue but that's the only reason I think

  • »
    »
    13 days ago, # ^ |
    Rev. 5   Vote: I like it +9 Vote: I do not like it

    Here u go -> Submission link

    It got accepted now. Once u form the final string, there are still some chances of getting a palindromic substring of length 3. So to handle that case, I just added a few lines of code in the end of your main logic. Happy Coding :)

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

      Aha thanks, seems a very cool hack :)

      If it would be codeforces, I guess it would still have a chance to get uphacked, or maybe there is a proof of its correctness.

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

    I used the same logic but instead of sorting I used priority queue for tracking frequency.

    Submission Link

»
12 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Rating change when?

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

    Due to an error in the ratings calculation of some users in JUNE221, the ratings are being recalculated since then. START44’s rating calculation will hence be delayed, and should be available by the end of the day.

    • »
      »
      »
      12 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks for the info

    • »
      »
      »
      12 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      CodeChef_admin there is a bug in the rating changes. Starters 44 became rated for a div1 participant

      https://www.codechef.com/users/gangwar_tanmay (A div1 participant got his ratings changed even though he he should not be rated for the competition)

      Please correct these changes!

      • »
        »
        »
        »
        12 days ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        That is intended. If you check the data point, you see that this user had participated in START44B and not in START44A. This is because the user's rating has been changed due to the changes done since yesterday — it had been lower when they had participated in the contest. This leads to the weird case of the user having taken part in a Div-2 contest even though retroactively, their rating is in Div-1. We will be keeping the contest rated for such users, and there will no further changes in this regard.