My issue
its failing in last test case why?
My code
//Radhe Radhe
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll M = 998244353;
ll Factorial[500000+10];
ll add(ll x, ll y) { return (x%M + y%M)%M; }
ll sub(ll x, ll y) { return (x%M - y%M + M)%M;}
ll mul(ll x, ll y) { return (x%M * y%M)%M; }
void print(vector<ll>v1){
for(auto x:v1){cout<<x<<" ";}
cout<<endl;}
ll binexp(ll a,ll b){
ll res = 1;
while(b){
if(b&1)res = ((res%M)*(a%M)%M);
a = ((a%M)*(a%M)%M);
b>>=1LL;
}
return res%M;
}
void make_factorial()
{
Factorial[0]=1;
for(int i=1;i<500010;i++)
Factorial[i]=(Factorial[i-1]*i)%M;
}
ll Mod_Inv(ll a)
{
return binexp(a%M,M-2);
}
int nCr(ll n,ll r)
{
return (((Factorial[n]*Mod_Inv(Factorial[r]))%M)*Mod_Inv(Factorial[n-r]))%M;
}
void Radhe(){
ll t;
cin>>t;
while(t--){
// I don't care about Rating , I like Experience
ll n,c;
cin>>n>>c;
vector<ll>v1(n);
for(int i=0;i<n;i++)cin>>v1[i];
ll sum = accumulate(v1.begin(),v1.end(),0LL);
ll sum1 = sum;
ll sum2 = 0;
sort(v1.begin()+1,v1.end());
ll ans = 0;
for(int i=1;i<n;i++){
sum1-=v1[i];
sum2+=v1[i];
if(sum1*sum2 <= c)ans++;
else break;
}
cout<<n-ans<<endl;
}
}
int main(){
Radhe();
return 0;
}
Problem Link: Destroying Bridges Part 2 Practice Coding Problem