답안 #979089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
979089 2024-05-10T08:25:17 Z Sandarach151 Med (COCI22_med) C++17
50 / 50
1 ms 600 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct