If what you intend is declaring an empty two dimensional vector[3][10]
, you can do it at once.
#include <iostream>
#include <vector>
int main()
{
std::vector<std::vector<int>> dp(3,std::vector<int>(10));
std::cout<<dp.size(); //3
std::cout<<std::endl<<dp[0].size(); //10
}
Then you can assign values to it by using something like dp[0][4]=12;
or with loops.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…