KK 与答辩

KK 与答辩

解读一下题:如果在所有场的答辩中,有某个人的总分都要低于kk的总分,就说kk碾压该人 --> 如果在某场答辩中这个人的总分大于kk,那么就说明kk不能碾压该人。

思路就清晰了,我们只要将这个人(在某场答辩中这个人的总分大于kk)标记,最后在所有人遍历一遍,没有被标记的就是被kk碾压的人

注意,分数低于kk也就是 只有小于没有等于。

ACOED


#include <bits/stdc++.h>

#define ll long long
#define endl '\n'
using namespace std;
int main() {
    int t; cin >> t;
    while (t --> 0){
        int n; cin >> n;
        vector<string> ve;
        map<string,bool>mp;
        map<string,bool> ans;
        for (int i = 1; i <= n; i++) {
            int a,aim; cin >> a;
            for (int j = 1; j <= a; j++) {
                string s;
                int p,q; cin >> s >> p >> q;
                if(!mp[s]){
                    ve.push_back(s),mp[s]=true;
                }
                if(j == 1)aim = p+ q;
                else {
                    if(p+q >= aim)ans[s] = true;
                }
            }
        }
        int count = 0;
        for (int i = 1; i <= ve.size()-1; i++) {
            if(!ans[ve[i]])count++;
        }
        cout << count << endl;
    }
    return 0;
}
posted @ 2023-02-11 19:02  TFOREVERY  阅读(23)  评论(0编辑  收藏  举报