1766 - URI

Run Settings
LanguageC++
Language Version
Run Command
#include <bits/stdc++.h> using namespace std; struct rena{ string nome; int peso; int idade; double altura; }; bool comp(rena a, rena b){ if(a.peso != b.peso) return a.peso > b.peso; else if(a.idade != b.idade) return a.idade < b.idade; else if(a.altura != b.altura) return a.altura < b.altura; else return a.nome < b.nome; } int main() { int testes, tr, r, p, id; double a; vector <rena> estab; string s; cin >> testes; for(int i = 1; i <= testes; i++){ cin >> tr >> r; for(int j = 0; j < tr; j++){ cin >> s >> p >> id >> a; rena r1 {s,p,id,a}; estab.push_back(r1); } sort(estab.begin(), estab.end(), comp); printf("CENARIO {%d}\n", i); for(int j = 0; j < r; j++){ cout << j+1 << " - " << estab[j].nome << "\n"; } estab.clear(); } return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines