其他分享
首页 > 其他分享> > L2-019 悄悄关注

L2-019 悄悄关注

作者:互联网

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    int n;
    cin >> n;
    set<string> S;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        S.insert(s);
    }    
    ll m;
    cin >> m;
    vector<pair<string, ll>> all(m);
    ll sum = 0;
    for (int i = 0; i < m; i++) {
        cin >> all[i].first >> all[i].second;
        sum += all[i].second;
    }
    vector<string> res;
    for (int i = 0; i < m; i++) {
        if (all[i].second * m > sum && !S.count(all[i].first)) {
             res.push_back(all[i].first);
        }
    }
    if (res.empty()) {
        cout << "Bing Mei You" << "\n";
    } else {
        sort(res.begin(), res.end());
        for (int i = 0; i < res.size(); i++) {
            cout << res[i] << "\n"[i == res.size() - 1];
        }
    }
    

    return 0;
}

标签:int,res,悄悄,cin,++,second,L2,019,sum
来源: https://www.cnblogs.com/ZhengLijie/p/16026248.html