Submission #11508322


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define pi pair<ll,ll>

void solve(){
    int n, m;   cin >> n >> m;
    int ans = 0;
    vector<ll> v(n);
    for (int i = 0; i < n; i += 1) {
        cin >> v[i];
    }

    ll sum = accumulate(v.begin(), v.end(), 0LL);
    for (int i = 0; i < n; i += 1) {
        if (v[i]*4*m >= sum)
            ans += 1;
    }
    
    if (ans >= m)
        cout << "Yes\n";
    else 
        cout << "No\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);	cout.tie(0);

    int test = 1;
    // cin >> test;
    while(test--)
        solve();
    return 0;
}

Submission Info

Submission Time
Task B - Popular Vote
User harshraj22
Language C++14 (GCC 5.4.1)
Score 200
Code Size 675 Byte
Status AC
Exec Time 1 ms
Memory 256 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 16
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, hand_03, hand_04, hand_05, hand_06, max_01, max_02, random_01, random_02, random_03, random_04, random_05, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_01 AC 1 ms 256 KiB
hand_02 AC 1 ms 256 KiB
hand_03 AC 1 ms 256 KiB
hand_04 AC 1 ms 256 KiB
hand_05 AC 1 ms 256 KiB
hand_06 AC 1 ms 256 KiB
max_01 AC 1 ms 256 KiB
max_02 AC 1 ms 256 KiB
random_01 AC 1 ms 256 KiB
random_02 AC 1 ms 256 KiB
random_03 AC 1 ms 256 KiB
random_04 AC 1 ms 256 KiB
random_05 AC 1 ms 256 KiB
sample_01 AC 1 ms 256 KiB
sample_02 AC 1 ms 256 KiB
sample_03 AC 1 ms 256 KiB