제출 #979089

#제출 시각아이디문제언어결과실행 시간메모리
979089Sandarach151Med (COCI22_med)C++17
50 / 50
1 ms600 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<pair<int, string> > score(n);
    vector<pair<int, string> > arr(n);
    for(int i=0; i<n; i++){
        cin >> score[i].second;
        score[i].first = 0;
        for(int j=0; j<5; j++){
            int a;
            cin >> a;
            score[i].first -= a;
        }
        arr[i] = score[i];
    }
    sort(score.begin(), score.end());
    for(int i=0; i<n; i++){
        int minpos = lower_bound(score.begin(), score.end(), make_pair(arr[i].first-500, arr[i].second))-score.begin();
        int maxpos = lower_bound(score.begin(), score.end(), make_pair(arr[i].first+500, arr[i].second))-score.begin();
        cout << minpos+1 << ' ' << maxpos << '\n';
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...