#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct el{
  int x, t;
};

bool cmp(el l, el r){
  if (l.x == r.x)
    return l.t > r.t;
  else
    return l.x < r.x;   
}

int main() {
  vector<el> v = {{1, 1}, {3, -1}, {3, 1}, {5, -1}};
  sort(v.begin(), v.end(), cmp);
  for (el e : v){
    cout << e.x << " " << e.t << endl;
  }

}
Последнее изменение: Суббота, 15 Август 2020, 02:35