Submission #837217

#TimeUsernameProblemLanguageResultExecution timeMemory
837217LinkedArrayMed (COCI22_med)C++17
50 / 50
2 ms340 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...