标签:back std names 行存储 code cto insert printf 大致
#include<iostream>
#include<set>
#include<map>
#include<vector>
using namespace std;
vector<int> all[100010];
int main(){
int n, m, a, b;
scanf("%d%d", &n, &m);
map<int, int> mp;
for(int i = 0; i < n; i++){
scanf("%d%d", &a, &b);
all[a].push_back(b);
all[b].push_back(a);
}
int k;
for(int i = 0; i < m; i++){
scanf("%d", &k);
vector<int> v(k);
set<int> s;
for(int j = 0; j < k; j++){
scanf("%d", &v[j]);
s.insert(v[j]);
}
int flag = 1;
for(int j = 0; j < k; j++){
for(int p = 0; p < all[v[j]].size(); p++){
if(s.find(all[v[j]][p]) != s.end()){
printf("No\n");
flag = 0;
break;
}
}
if(flag == 0) break;
}
if(flag == 1) printf("Yes\n");
}
return 0;
}
A1149 Dangerous Goods Packaging (25分)
标签:back std names 行存储 code cto insert printf 大致
原文地址:https://www.cnblogs.com/tsruixi/p/13174318.html