#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<std::vector<double>> vector1 = {{4,3,5,3},
{2,6,3,7},
{6,8,5,1},
{5,6,1,5}};
std::sort(vector1.begin(),
vector1.end(),
[] (const std::vector<double> &a, const std::vector<double> &b)
{
return a[3] < b[3];
});
for (auto &r : vector1)
{
for (auto e : r)
std::cout << e << " ";
std::cout << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKaW50IG1haW4oKQp7CglzdGQ6OnZlY3RvcjxzdGQ6OnZlY3Rvcjxkb3VibGU+PiB2ZWN0b3IxID0ge3s0LDMsNSwzfSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsyLDYsMyw3fSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs2LDgsNSwxfSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs1LDYsMSw1fX07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICBzdGQ6OnNvcnQodmVjdG9yMS5iZWdpbigpLAogICAgICAgICAgICAgIHZlY3RvcjEuZW5kKCksCiAgICAgICAgICAgICAgW10gKGNvbnN0IHN0ZDo6dmVjdG9yPGRvdWJsZT4gJmEsIGNvbnN0IHN0ZDo6dmVjdG9yPGRvdWJsZT4gJmIpCiAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICByZXR1cm4gYVszXSA8IGJbM107CiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgCiAgICBmb3IgKGF1dG8gJnIgOiB2ZWN0b3IxKQogICAgewogICAgCWZvciAoYXV0byBlIDogcikKICAgIAkJc3RkOjpjb3V0IDw8IGUgPDwgIiAiOwogICAgCXN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7CiAgICB9CiAgICAKCXJldHVybiAwOwp9