import java.io.*;import java.util.*;publicclassMain{publicstaticvoidmain(String[] args)throws IOException {//输入
BufferedReader bf =newBufferedReader(newInputStreamReader(System.in));
PrintWriter out =newPrintWriter(newOutputStreamWriter(System.out));int n = Integer.parseInt(bf.readLine());
String[][] str =newString[n][2];for(int i =0; i < n; i++){
str[i]= bf.readLine().split(" ");}int num = Integer.parseInt(bf.readLine());
String[] buf = bf.readLine().split(" ");//
Set<String> set =newTreeSet<>();
StringBuffer sb=newStringBuffer("");for(int i =0; i < num; i++){
set.add(buf[i]);}for(int j=0;j<n;j++){if(set.contains(str[j][0])&&set.contains(str[j][1])){
num-=2;
set.remove(str[j][0]);
set.remove(str[j][1]);}else{continue;}}
System.out.println(num);boolean isFirst =true;for(String id : set){if(!isFirst){
System.out.print(" ");}
System.out.print(id);
isFirst =false;}
out.flush();}}
[柳](https://www.liuchuo.net/archives/2740)#include<iostream>#include<vector>#include<set>usingnamespace std;intmain(){int n, a, b, m;scanf("%d",&n);
vector<int>couple(100000,-1);for(int i =0; i < n; i++){scanf("%d%d",&a,&b);
couple[a]= b;
couple[b]= a;}scanf("%d",&m);
vector<int>guest(m),isExist(100000);for(int i =0; i < m; i++){scanf("%d",&guest[i]);if(couple[guest[i]]!=-1)
isExist[couple[guest[i]]]=1;}
set<int> s;for(int i =0; i < m; i++){if(!isExist[guest[i]])
s.insert(guest[i]);}printf("%d\n", s.size());for(auto it = s.begin(); it != s.end(); it++){if(it != s.begin())printf(" ");printf("%05d",*it);}return0;}