Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool comp(const pair<int, int> &a, const pair<int, int> &b) {
- if (a.second != b.second) {
- return (a.second > b.second);
- }
- else {
- return (a.first < b.first);
- }
- }
- void task3() {
- int n;
- cin >> n;
- vector <pair <int, int>> numbers(n);
- for (int i = 0; i < n; i++) {
- int current_in, current_result;
- cin >> current_in >> current_result;
- numbers[i] = { current_in, current_result };
- }
- sort(numbers.begin(), numbers.end(), comp);
- for (auto i : numbers) {
- cout << i.first << " " << i.second;
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement