Codeforces Round #678 (Div. 2) A Reorder
My answer for test 1 is YES NO But the answer given to me in the evaluation machine is NO NO
MY CODE:
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
const int N=100005;
int a[1005];
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int tt;cin>>tt;
while(tt--) {
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+1+n);
double sum=0.00;
for(int i=1;i<=n;i++) {
for(double j=i;j<=n;j++) {
sum+=(double)a[(int)j]/j;
}
}
if((int)sum==m) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
/*
*/