-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1766.cpp
More file actions
41 lines (37 loc) · 904 Bytes
/
1766.cpp
File metadata and controls
41 lines (37 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <bits/stdc++.h>
using namespace std;
struct rena{
string nome;
int peso;
int idade;
float altura;
};
bool ordena(rena a, rena b){
if(a.peso == b.peso)
if(a.idade == b.idade)
if(a.altura == b.altura)
return a.nome < b.nome;
else
return a.altura < b.altura;
else
return a.idade < b.idade;
else
return a.peso > b.peso;
}
int main(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
int m, k;
cin >> m >> k;
vector <rena> v(m);
for(int j = 0; j < m; j++){
cin >> v[j].nome >> v[j].peso >> v[j].idade >> v[j].altura;
}
sort(v.begin(), v.end(), ordena);
cout << "CENARIO {" << i+1 << "}" << endl;
for(int j = 0; j < k; j++){
cout << j+1 << " - " << v[j].nome << endl;
}
}
}