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;
}

posted @ 2022-03-19 13:50  Xxaj5  阅读(20)  评论(0编辑  收藏  举报