Задачі
Результати олімпіади
include <bits/stdc++.h>
using namespace std; using ll = long long;
int main() { iosbase::syncwith_stdio(0); cin.tie(0);
int n;
cin >> n;
vector<pair<int,int>> v;
for(int i=0; i<n; i++){
int a,b;
cin >> a >> b;
v.push_back({-b,a});
}
sort(v.begin(), v.end());
for(auto i: v){
cout << i.second << " " << -i.first << endl;
}
}
include <bits/stdc++.h>
define ll long long
define ld long double
using namespace std; struct points{
ll x, y;
}; bool comp(points a, points b){
if(a.y > b.y){
return a.y > b.y;
}
else if(a.y == b.y){
return a.x < b.x;
}
return b.y < a.y;
} int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, x, y;
cin>>n;
vector<points>v;
for(int i = 0; i<n; i++){
cin>>x>>y;
v.push_back({x, y});
}
sort(v.begin(), v.end(), comp);
for(int i = 0; i<v.size(); i++){
cout<<v[i].x<<' '<<v[i].y<<endl;
}
} //TECHNOBLADE NEVER DIE