Invitation to ICM Technex 2020 - IIT (BHU) Varanasi

I applied binary search on the answer. Here is my code.
Btw, how did you solved the 3rd one? What was your thought process in that?

the jee one

I could not solve the 4th one. how did you solve it? any idea?

Diffrentiate it by hand first. Set min to and max to pi/2. Do binary search, if slope is negative, go ahead, if slope is positive go behind. Then compute the value for f(x)

1 Like

How to solve Third question.?
Are These Equal

For “Are these equal”

I checked two things

  1. The sum of elements must be a multiple of k

  2. The minimum no of operations would be equal to maximum element in array and The maximum operations would be simply sum//k
    Then i just checked if minimum is less than or equal to maximum value.

I just checked these two condition for Output

Code
        int n,k;
        cin>>n>>k;
        int a[n];
        for(int i=0;i<n;i++)
            cin >> a[i];
        sort(a,a+n);
        int sum = accumulate(a,a+n,0);
        int maxi=a[n-1];
        int temp=sum/k;
        if(sum%k==0 && temp>=maxi)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
        
1 Like

Any mathematical proof for your this condition I thought of these but was not having proof to do that?

1 Like

I mean, think of it as non overlapping increments. I will be honest, i don’t have any mathematical proof as well. It’s just instinct

I understand that first condition is only necessary but not sufficient. During the contest, I was not so sure about the second condition. Can you tell me how can you always construct the answer when both the conditions are satisfied?

ok so getting intuition was only main thing in the contest that’s why I don’t like such adhoc problemsets.

anyways Nice intuition keep it up bro.

1 Like

To make up the maximum element(max) we need to do at least max operations on a single element which will cause a net increase of max * k in the array.
On that lines I built the solution.
But I can’t prove that : For every larger value of sum greater than max * k and divisible by k
the solution will surely exist.
I submitted without proving :stuck_out_tongue:

2 Likes

I can say some random proofs, but I’m not sure and i don’t want to misguide someone. Let’s wait for the editorial, shall we?:slightly_smiling_face:

Thanks My mind was chocked to think that later condition that answer will exist always if max<=(sum/k) great minded persons submitted this question.

No harm in giving a try.

1 Like

@ abhas_j when the problems will be available for practice?

Please explain why do you think so??

https://www.codechef.com/viewsolution/29730519

Does this contest have a editorial?

1 Like

Editorials will be posted soon.

2 Likes