vivekcrux's blog

By vivekcrux, history, 5 years ago, In English

Can anyone suggest how can I approach this problem:-
https://www.codechef.com/FFC22019/problems/FFC219A
I have looked at few submissions, most of them are using the similar type of approach, but I'm not able to understand the concept behind it. Any help is appreciated.

  • Vote: I like it
  • -8
  • Vote: I do not like it

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

It was a copied question from codeforces. Just take a look at this:-
https://codeforces.com/contest/622/problem/F .
Look at it's editorial if you want the slution approach.

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

    Thanks

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

      have you understood, I still haven't understood, can you please explain it in easy way if possible

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

        I also got only the part when n < k+2, and trying to understand the part for n > k+1.

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

I tried lagrange interpolation (see geeksforgeeks or CP algorithm), as a similar problem appeared some months back in a long challenge(June challenge, 2019 i believe, div.1 6th problem), but to no avail as I couldn't get rid of TLE due to such tight constraints.... :(