This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500, MAXB = 500, NRB = 5;
string name[MAXN];
int sum[MAXN];
int main() {
int n, i, j, b, pos1, pos2;
cin >> n;
for(i = 0; i < n; i++){
cin >> name[i];
for(j = 0; j < NRB; j++){
cin >> b;
sum[i] += b;
}
}
for(i = 0; i < n; i++){
pos1 = 1;
pos2 = 0;
for(j = 0; j < n; j++){
if( (sum[i] + MAXB < sum[j]) || (sum[i] + MAXB == sum[j] && name[i] > name[j]) ){
pos1++;
}
if( (sum[j] + MAXB > sum[i]) || (sum[j] + MAXB == sum[i] && name[i] > name[j]) ){
pos2++;
}
}
cout << pos1 << ' ' << pos2 << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |