/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main()
{
vector<pair<int64_t, double>> v;
v.push_back(make_pair(1, 0.01));
v.push_back(make_pair(2, 0.02));
v.push_back(make_pair(3, 0.01));
v.push_back(make_pair(3, 0.03));
v.push_back(make_pair(2, 3.14));
v.push_back(make_pair(1, 3.14));
v.push_back(make_pair(5, 2.41));
v.push_back(make_pair(5, 2.47));
v.push_back(make_pair(1, 9.31));
v.push_back(make_pair(5, 7.31));
std::sort(v.begin(), v.end(),
[](pair<int64_t, double>& a,
pair<int64_t, double>& b) {
if (a.first < b.first) {
return true;
} else if (b.first < a.first) {
return false;
} else {
return &a > &b;
}
});
for (auto&& e : v) {
cout << e.first << " " << e.second << " ";
}
return 0;
}