#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b vector dijkstra(int s,vector>> &G){ const T TINF=numeric_limits::max(); using P=pair; int n=G.size(); vector d(n,TINF); vector b(n,-1);//previous point priority_queue,greater

> q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n,m;cin>>n>>m; vector>> g(n); rep(i,m){ int u,v;cin>>u>>v;u--,v--; g[u].push_back({v,1}); g[v].push_back({u,1}); } int q;cin>>q; while(q--){ int st;cin>>st;st--; auto dis=dijkstra(st,g); int cnt=0,ans=0; rep(i,n){ if(dis[i]