Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Author - Abhas Jain
- * Code is inside the solve function
- */
- #include <bits/stdc++.h>
- #define endl '\n'
- typedef long long ll;
- using namespace std;
- void solve ()
- {
- int t;
- cin >> t;
- while (t--) {
- int n, k;
- cin >> n >> k;
- vector<ll> ar(n);
- ll sum = 0;
- ll mx = 0;
- for (int i = 0; i < n; ++i) {
- cin >> ar[i];
- sum += ar[i];
- mx = max(mx, ar[i]);
- }
- if (sum % k != 0 || sum / k < mx) {
- cout << "NO" << endl;
- } else cout << "YES" << endl;
- }
- }
- int main()
- {
- solve();
- return 0;
- }
Add Comment
Please, Sign In to add comment