problem link
This is similar to mixtures problem discussed in course using same approach but getting wa on some cases
problem link
This is similar to mixtures problem discussed in course using same approach but getting wa on some cases
hello @kks2029
try doing this->
a) use long long
b) assign number bigger than INT_MAX in ur min cos variable
I am using long long and how to assign number bigger than intmax?
INT_MAX value is close to 10^9 which is not sufficient as max.
assign 10^12
how? like this -> variable=100… .
all test case still not passed I have updated the code
answer can even exceed 10^12.
use 10^15 , it will work
worked!! but why would I set that? worst case n=400 a[i]=10e9 so max sum will 10e9 *400=10e12
…
thats the cost of one single operation when u finally combine last two slimes.
more cost will be needed to merge smaller slimes and get two bigger slimes. answer remain closer to 10^12 only , to avoid any issue its better to initilase with big number