#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, string>> b(n);
for (int i = 0; i < n; i++) {
cin >> b[i].second;
int total = 0;
for (int j = 0; j < 5; j++) {
int d; cin >> d;
total += d;
}
b[i].first = total;
}
sort(b.begin(), b.end());
vector<int> a(n);
for (int i = 0; i < n; i++) a[i] = b[i].first;
for (int i = 0; i < n; i++) {
int total = b[i].first;
string name = b[i].second;
int min_sum = total + 500;
int max_sum = total - 500;
int minimum = n - (lower_bound(a.begin(), a.end(), min_sum) - a.begin());
int maximum = n - (lower_bound(a.begin(), a.end(), max_sum) - a.begin());
cout << minimum << " " << maximum << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |