L1-020 帅到没朋友 分数 20

有前导零,末尾不能有空格,会卡格式

// 17'05"
#include <bits/stdc++.h>
using namespace std;
int main()
{
    map<string,bool> hash;
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++ i)
    {
        int k;
        cin >> k;
        if(k == 1)
        {
            string tmp;
            cin >> tmp;
            continue;
        }
        for(int j = 1; j <= k; ++ j)
        {
            string tmp;
            cin >> tmp;
            hash[tmp] = true;
        }
    }
    int q;
    cin >> q;
    int flag = false;
    int flag2 = false;
    map<string,bool> hash2;
    while(q --){
        string tmp;
        cin >> tmp;
        if(hash[tmp] == false && hash2[tmp] == false)
        {
            if(flag2) cout << " ";
            cout << tmp;
            flag = true;
            flag2 = true;
            hash2[tmp] = true;
        }
    }
    if(!flag) cout << "No one is handsome";
    cout << endl;
    return 0;
}
posted @ 2024-07-31 23:30  Frodnx  阅读(12)  评论(0)    收藏  举报