问题:

    • 没有考虑自恋狂,也就是朋友圈只有一个人的…
    • 没考虑没有人太帅这种情况,orz
      1. #include<iostream>
      2. #include<cstring>
      3. #include<cmath>
      4. #include<algorithm>
      5. #include<unordered_map>
      6. using namespace std;
      7. int N,M;
      8. const int MAXN = 1e5+10;
      9. unordered_map<string,int> umap;
      10. int main(){
      11. cin >> N;
      12. while(N--){
      13. int k;
      14. string s;
      15. cin >> k;
      16. bool flag = true;
      17. if(k==1) flag = false;
      18. while(k--){
      19. cin >> s;
      20. if(flag) umap[s]=1;
      21. }
      22. }
      23. cin >> M;
      24. string s;
      25. int cnt = 0; // 用于输出格式控制
      26. for(int i=1;i<=M;i++){
      27. cin >> s;
      28. if(!umap[s]){
      29. cnt++;
      30. umap[s]=-1;
      31. if(cnt==1) cout << s;
      32. else cout << " " << s;
      33. }
      34. }
      35. if(!cnt) cout << "No one is handsome" << endl;
      36. return 0;
      37. }