//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
mt19937 gen{ random_device()() };
uniform_int_distribution<> uid(1, 100);
vector> v2d(3, vector(3));
int max_i;
for_each(v2d.begin(), v2d.end(), [&max_i, &uid, &gen](vector& v) {
generate(v.begin(), v.end(), [&uid, &gen]() { return uid(gen); });
max_i = max(*max_element(v.begin(), v.end()), max_i);
});
cout << endl;<br> v2d.erase(remove_if(v2d.begin(), v2d.end(), [&max_i](vector& v) {
return find(v.begin(), v.end(), max_i) != v.end();
}), v2d.end());
for (const auto& i : v2d)
{
copy(i.begin(), i.end(), ostream_iterator(cout, " "));
cout << endl;<br> }
}