I would like to invite you all to the International Coding Marathon 2020 , under the banner of Technex’20, IIT (BHU) Varanasi.
Technex is the annual techno-management fest of Indian Institute of Technology (BHU), Varanasi organized from February 14 — 16, 2020.
International Coding Marathon is the flagship event of Byte The Bits, the set of programming events organized under Technex. It will take place on Sunday, 16th Feb 2020, 14:00 IST.
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)
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;