#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
int main(){
int n,m,k,a,b;
cin >> n >> m;
vector<int> v(10010);
for(int i=0;i<n;i++){
scanf("%d %d",&a,&b);
v[a].push_back(b);
v[b].push_back(a);
}
while(m--){
cin >> k;
set<int> g;
for(int i=0;i<k;i++){
scanf("%d",&a);
g.insert(a);
}
bool flag=true;
for(int i=0;i<k;i++){
for(int j=0;j<v[i].size();j++)
if(g.find(v[g(i)][j])!=g.end()){
printf("No\n");
flag=false;
break;
}
if(!flag) break;
}
if(flag==true) printf("Yes\n");
}
return 0;
}
dev的提示是
In function 'int main()':
[Error] request for member 'push_back' in 'v.std::vector<_Tp, _Alloc>::operator[]<int, std::allocator<int> >(((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
14 8 [Error] request for member 'push_back' in 'v.std::vector<_Tp, _Alloc>::operator[]<int, std::allocator<int> >(((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
25 23 [Error] request for member 'size' in 'v.std::vector<_Tp, _Alloc>::operator[]<int, std::allocator<int> >(((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
26 20 [Error] no match for call to '(std::set<int>) (int&)'
求問一下,這啥情況昂?
uj5u.com熱心網友回復:
你對vector的理解是錯誤的vector<int> xxx(1000) 代表初始化一個長度為1000的vector<int> ;相當于int x[1000];
vector[a] 回傳的是他內部一個物件其實就是 一個int
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/14279.html
標籤:C++ 語言
上一篇:c++程式自己執行兩次
