May Long 2019 Solutions Sketches

Seriously brother math god!! @l_returns

3 Likes

thanks but I’m far away from being math god… :slight_smile:

2 Likes

How to be good in maths in competitive programming?

I really don’t know… I love maths since 8th standard… I just did maths from 8th to 10th… :joy:

2 Likes

Same quetstion. :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue:

1 Like

I_sees… !!! _/_

And there is usually a good deal of difference between CF and CC editorials.

1 Like

what ??

Sir in question when to build roads, is it allow to build restaurant on the road

Just thought of this and thought it explains the formula pretty well.
a + b + a * b = (a + 1) * (b + 1) - 1.
Now, for ((a, b) , c) , we can substitute the above result as ((a + 1) * (b + 1) - 1, c)
Expanding this we get (a + 1) * (b + 1) * (c + 1) - 1. Hence, no matter how many operations you do and in what order you do, you will get (a + 1) * (b + 1) * (c + 1) * … - 1. Since the numbers here go from 1 to N, our answer become (1 + 1) * ( 2 + 1) * (3 + 1) * … * (N + 1) - 1. This is essentially (N + 1)! - 1.

Hope this helps.

2 Likes

How u have expanded (a+1)*(b+1)-1 ,c ?? @gameface_123

1 Like

Let (a + 1) * (b + 1) - 1 = d
Then, (d, c) = (d + 1) * ( c + 1) - 1
But d = ( a + 1 ) * ( b + 1) - 1 .
Hence, (d + 1) = ( a + 1) * ( b + 1)
Hence, (d, c) = (a + 1) * (b + 1) * (c + 1) - 1

1 Like

Please provide the link for your editorials.

2 Likes

404 :stuck_out_tongue::joy::joy::joy:
Post must be at least 20 characters

1 Like

@vijju123 @I_returns can anyone plz find the error in this code for MATCHES problem
thanks in advance!!..

#include <math.h>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int maximum(int a,int b)
{
if(a>b)
return a;
else
return b;
}

int minimum(int a,int b)
{
if(a>b)
return b;
else
return a;
}

int main()
{
ll t;
cin>>t;
while(t–)
{
ll i,n,m,a,b,k;

   cin>>n>>m;

   i=0;

   while(n!=0&&m!=0)
   {
       
      i++;
      a=minimum(n,m);

      if(a==m)
      {
         n=n%m;

      }
      else
      {
          m=m%n;
      }

   }
   if((i-1)%2==0)
   {
       cout<<"Ari"<<endl;
   }
   else
   {
       cout<<"Rich"<<endl;
   }

}
}

Where are the editorials for May Long Challenge 2019??! @admin
Can you pls send the link…

Here is the editorial:-

Here it is:-Unofficial Editorial for ADAROOKS2-MAY-2019-LONG-CHALLENGE

not available yet
to check it yourself enter ‘may19’ in the search box on the page at

feels like this has been forgotten now. thats why editorial should be done before even contest starts.

3 Likes