#include<iostream>
#include<algorithm>
#include<numeric>//accumulate(be,en,0)
#include<cstring>//rfind("string"),s.find(string,begin)!=s.npos,find_first _of(),find_last_of()
#include<string>//to_string(value)
#include<cstdio>
#include<cmath>
#include<vector>//res.erase(unique(res.begin(), res.end()), res.end()),reverse(q.begin(),q.end());
#include<queue>//priority_queue(big) /priority_queue<int, vector<int>, greater<int>> q(small)
#include<stack>
#include<map>//unordered_map
#include<set>//iterator,insert(),erase(),lower(>=)/upper_bound(>)(value)/find()return end()
#define ll long long
#define PII pair<int,int>
#define f first
#define s second
using namespace std;
const int inf=0x3f3f3f3f,N=510;
vector<int>q[N];
int a[N];
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0),cout.tie(0);
int n,r,k;
cin>>n>>r>>k;
while(r--)
{
int a,b;
cin>>a>>b;
q[a].push_back(b);
q[b].push_back(a);
}
int m;
cin>>m;
for(int j=0;j<m;j++){
vector<int>book(N);
for(int i=1;i<=n;i++){
cin>>a[i];
}
bool ok=true;
for(int i=1;i<=n;i++){
book[a[i]]++;
for(auto w:q[i]){
if(a[w]==a[i]){
ok=false;
break;
}
}
}
int cnt=0;
for(int i=1;i<N;i++){
if(book[i]) cnt++;
}
if(cnt<k){
cout<<"Error: Too few species.\n";
}else if(cnt>k){
cout<<"Error: Too many species.\n";
}else if(ok&&cnt==k){
cout<<"Yes\n";
}else{
cout<<"No\n";
}
}
}
1170 Safari Park
最新推荐文章于 2024-08-09 10:25:03 发布