[Solved] Can’t push_back() after 1000th element in a vector in c++11 [closed]
The 1000th element is actually just 1 due to this constructor. vector <long long> vec(2000,1); // fill with 2000 elements, each set to 1 Then after this line vec.push_back(31); // element [2000] is now 31 Therefore your final vector is {1, 1, 1, …, 1, 1, 31} // length 2001 elements solved Can’t push_back() after … Read more