The ladder cup is so handsome that it has no friends

L1-020. Too handsome to have no friends

time limit
200 ms
memory limit
65536 kB
code length limit
8000 B
Judgment procedure
Standard
author
Chen Yue

When everyone is busy posting photos in the circle of friends, there are always some people who have no friends because they are too handsome. This question asks you to find people who are so handsome that they have no friends.

Input format:

Enter the first line to give a positive integer N (<=100), which is the number of known circles of friends; the next N lines, each line first gives a positive integer K (<=1000), which is the number of people in the circle of friends , and then list all the people in a circle of friends - for convenience, each person corresponds to an ID number, which is a 5-digit number (from 00000 to 99999), and the IDs are separated by spaces; then a positive integer M (< =10000), which is the number of people to be queried; M IDs to be queried are listed in the next line, separated by spaces.

Note: People without friends can be people who have not installed "Moments" at all, or they can be people who are only in the Moments by themselves. Although some narcissists will repeatedly add themselves to the circle of friends, the title guarantees that all circles of friends with K more than 1 have at least 2 different people.

Output format:

Output those who are so handsome that they have no friends in the order they were entered. The IDs are separated by 1 space, and there must be no extra spaces at the beginning and end of the line. If no one is handsome, output "No one is handsome".

Note: The same person can be queried multiple times, but only output once.

Input sample 1:
3
3 11111 22222 55555
2 33333 44444
4 55555 66666 99999 77777
8
55555 44444 10000 88888 22222 11111 23333 88888
Sample output 1:
10000 88888 23333
Input sample 2:
3
3 11111 22222 55555
2 33333 44444
4 55555 66666 99999 77777
4
55555 44444 22222 11111
Sample output 2:
No one is handsome
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n,m,x,y,t,sum=0,p[100000]={0};
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>t;
        for(int j=1;j<=t;j++){
            cin>>m;
            if(t!=1){
                p[m]=1;
            }
        }
    }
    cin>>x;
    for(int i=1;i<=x;i++){
        cin>>y;
    if(p[y]==0){
        if(sum!=0){
            cout<<"" ;
        }
        printf("%05d",y);
        p[y]=-1;
        sum++;
    }
    }
    if(sum==0)
        cout<<"No one is handsome";
        cout<<endl;
return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325683757&siteId=291194637