Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- struct dt{
- string name; double n1, n2, n3;
- friend bool operator<(dt a, dt b){
- if(a.n2 != b.n2) return a.n2 > b.n2;
- if(a.n1 != b.n1) return a.n1 > b.n1;
- return a.n3 > b.n3;
- }
- };
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- // freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- ll n; cin >> n;
- dt arr[n];
- for(ll i = 0; i < n; i++){
- string name; double n1, n2, n3;
- cin >> arr[i].name >> arr[i].n1 >> arr[i].n2 >> arr[i].n3;
- }
- sort(arr, arr+n);
- for(ll i = 0; i < n; i++){
- auto [name, n1, n2, n3] = arr[i];
- cout << i+1 << ". " << name << " " << n1 << " " << n2 << " " << n3 << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement