Home > Back-end >  C PAT A1149 vector
C PAT A1149 vector

Time:11-23

 # include 
#include
#include
#include
#include
using namespace std;
Int main () {
Int n, m, k, a, b;
Cin & gt;> N & gt;> m;
vector V (10010);
for(int i=0; iThe scanf (" % d % d ", & amp; a,& B);
V [a]. Push_back (b);
V [b] the push_back (a);
}
While (m -) {
Cin & gt;> k;
Set g;
for(int i=0; iThe scanf (" % d ", & amp; a);
G.i nsert (a);
}
Bool flag=true;
for(int i=0; ifor(int j=0; jIf (g.f ind (v (g (I)) [j])!=g.e nd ()) {
Printf (" \ n ");
flag=false;
break;
}
if(! Flag) break;
}
If (flag==true) printf (" Yes \ n ");
}
return 0;
}

The message dev is
In the function 'int main ()' :
[Error] request for member 'push_back' in 'v. td: : vector (((STD: : vector : : size_type) a)) ', which is of non - class type '__gnu_cxx: : __alloc_traits & lt; STD: : allocator : : value_type (aka int} '
14 8 [Error] request for member 'push_back' in 'v. td: : vector (((STD: : vector B: : size_type))) ', which is of non - class type '__gnu_cxx: : __alloc_traits & lt; STD: : allocator : : value_type (aka int} '
25 23 [Error] request for member 'size' 'in v. td: : vector (((STD: : vector : : size_type) I)) ', which is of non - class type '__gnu_cxx: : __alloc_traits & lt; STD: : allocator : : value_type (aka int} '
26 20 [Error] no match for the call to '(STD: : set) (int&) '
Please ask, what circumstance, this?

CodePudding user response:

It is wrong to your understanding of the vector
vector XXX (1000) on behalf of the initialization of a length of 1000 vector ; The equivalent of int x [1000];
The vector [a] returns an object, his inner is actually an int
  • Related