vector GN in cpp
Vector G[N] in C++ is an array of N vectors. It can be declared as follows:
vector
Here, each element of the array G is a vector of integers. The size of the vector can be changed dynamically at runtime using the push_back() function.
For example, to add an element x to the i-th vector in the array, we can use the following code:
G[i].push_back(x);
Similarly, to access the j-th element of the i-th vector, we can use the following code:
G[i][j]
Overall, using an array of vectors can be useful for storing and manipulating data in a flexible and efficient way.
原文地址: https://www.cveoy.top/t/topic/bBjr 著作权归作者所有。请勿转载和采集!