(Subscribe for more such videos) Code : #include using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
Bcoz when we are doing operation, one index should be 0 always, and from remaining 1 to n-1 indexes we pick the bricks and drop on index 0 as we are asked to make index 0 with max bricks possible. So we need 1 to n-1 sorted. I hope you got my point.
(Subscribe for more such videos)
Code :
#include
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t, n, i, j;
cin>>t;
for(;t--;)
{
cin>>n;
ll a[n];
for(i=0; i>a[i];
}
sort(a+1, a+n);
for(i=1; ia[0]){
if((a[i]+a[0])%2==0){
a[0]=(a[i]+a[0])/2;
}else{
a[0]=(a[i]+a[0])/2+1;
}
}
}
cout
I guess todays problem D was lower than a B level proble.What the hell was problem C!!!!!!
Problem C
Probably tomorrow...
why time complexity is o(nlogn)?
due to sort fn. used
Sir Problem A
Good! But if you speak in English, it will be more understandable for us.
Upload D fast
Coming soon ! I hope you enjoy it !
pura array kyu sort nhi kia?
Bcoz when we are doing operation, one index should be 0 always, and from remaining 1 to n-1 indexes we pick the bricks and drop on index 0 as we are asked to make index 0 with max bricks possible. So we need 1 to n-1 sorted. I hope you got my point.
@@codingcommunitynewtonschoo8582 yes got it thanks
D daaldo bhai pls
Will be uploaded by 1-1:30...
Problem C
Probably tomorrow...