L1-020 帥到沒朋友 分數 20

Frodnx發表於2024-07-31

有前導零,末尾不能有空格,會卡格式

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

相關文章