Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <utility>
- #include <algorithm>
- #include <string>
- #include <vector>
- using namespace std;
- bool compare(pair<int, string> x, pair<int, string> y) {
- if (x.first == y.first)
- return x.second.compare(y.second);
- return x.first > y.first;
- }
- int main() {
- int teste = 0;
- while (true) {
- int n;
- cin >> n;
- if (!n)
- break;
- vector<pair<int, string> > jog;
- for (int i = 1; i <= n; i++) {
- string nome;
- cin >> nome;
- vector<int> ps;
- for (int j = 1; j <= 12; j++) {
- int v;
- cin >> v;
- ps.push_back(v);
- }
- sort(ps.begin(), ps.end());
- int sum = 0;
- for (int i = 1; i <= 10; i++)
- sum += ps.at(i);
- jog.push_back(make_pair(sum, nome));
- }
- cout << "Teste " << ++teste << endl;
- sort(jog.begin(), jog.end(), compare);
- int posicao = 1;
- for (int i = 0; i < jog.size(); i++) {
- if (i == 0) {
- if (jog.at(i - 1).first == jog.at(i).first)
- posicao += 2;
- else
- posicao++;
- }
- cout << posicao << " " << jog.at(i).first << " " << jog.at(i).second << endl;
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement