solution
- “单身狗”:没有搭子或者搭子没来的参与者
- 输出id时按增序输出
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
const int maxn = 1e6, maxn1 = 1e4 + 10;
int flag[maxn] = {0}, all[maxn1];
int main(){int n, m, cp1, cp2, cnt = 0, x;map<int, int> mp;scanf("%d", &n);for(int i = 0; i < n; i++){scanf("%d%d", &cp1, &cp2);mp[cp1] = cp2;mp[cp2] = cp1;}scanf("%d", &m);for(int i = 0; i < m; i++){scanf("%d", all + i);flag[all[i]] = 1;}for(int i = 0; i < m; i++){if(mp.count(all[i]) && flag[mp[all[i]]]) continue;all[cnt++] = all[i];}sort(all, all + cnt);printf("%d\n", cnt);for(int i = 0; i < cnt; i++){printf("%05d", all[i]);if(i != cnt - 1) printf(" ");}return 0;
}