JaySharma1048576's blog

By JaySharma1048576, 6 months ago, In English

We invite you to participate in CodeChef's Starters 107, this Wednesday, 8th November, rated till 6-stars (i.e. for users with rating < 2500).

Time: 8:00 PM — 10:00 PM IST

Read about the recent judge migration here.

Joining us on the problem setting panel are:

Note: Some problems have subtasks.

Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest. The video editorials of the problems will be available only to Pro users.

Also, if you have some original and engaging problem ideas, and you're 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
  • +58
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I literally don't know how my solution for Maximal Sum worked.

Spoiler
  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Maximal Expression can anyone explain the case for n > k. [(n <= k) was pretty straight forward, but i couldnt solve it for (n > k)]. thanks :)

    • »
      »
      »
      6 months ago, # ^ |
      Rev. 5   Vote: I like it 0 Vote: I do not like it

      How I think

      Hint 1
      Hint 2
      Hint 3
    • »
      »
      »
      6 months ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it
      f(x) has a period of k
      

      proof: f(x)=(x%k)*((n-x)%k) f(x+k)=((x+k)%k)*((n-x-k)%k) f(x+k)=(x%k)*((n-x)%k)=f(x)


      that means we need to find value of f(x) for 0..k only to get the answer
      now take n%k
      let q=n%k
      q, . . ,0,k-1,k-2,...
      0,1,2,3,4,5,6,7,8,9
      q=(n-x)%k
      .
      .
      (0+x)*(q-x)=qx-x2
      from 0 to q
      f(x) will be max at x=q/2
      
      now from k-1 position
      (q+1+x)*(k-1-x)
      c=q+1
      d=k-1
      (c+x)(d-x)=cd+(d-c)x-x2
      so f(x) will be max at x=(d-c)/2
      where d-c=(k-1)-(q+1)
      so q+1+x=q+1+(k-q-2)/2
      
      ```
       ll n,k; cin>>n>>k;
          
          ;
          ll oans=0;
          if(k>=n){
              cout<<n/2<<endl; return;
          }
          ll rem=(n%k);
          ll tp=(rem)/2;
          //1 0
          //(1-x)*x=1-x2 x=0;
          //1*0
          ll ans=(rem-tp)*tp;
          if(rem+1>=k){
              verify(0);
              cout<<tp<<endl; return;
              
          }
          
          ll atp=(k-1)-(rem+1);
          ll r=(atp)/2;
          ll sans=(r+rem+1)*(k-1-r);
          if(max(ans,sans)==ans){
              verify(0);
              cout<<tp<<endl; return;
              
          }else{
              verify(0); 
              cout<<rem+1+r<<endl;  
              
          }
      ```
      
»
6 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Hello CodeChef_admin, could you please take a look at my account? It's displaying an inactive status, but I haven't been inactive for this long. Also, there hasn't been an update on my ratings for yesterday, I managed to solve A, B, and E problems from Div2. Previously, I could see my updated rating, but now it's not showing, so kindly review my account. Thanks!

Here is my account — lovedeep0022

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes , me too gave codechef starters 107 and solved 2 problems but right now my rating is not updated on my profile and I checked my friend 's profiles and they are updated

    My account — do4z

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hi, thanks for reporting. It should be fixed now.

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Game over