답안 #704850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704850 2023-03-03T05:32:48 Z guagua0407 Med (COCI22_med) C++17
50 / 50
1 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define all(x) x.begin(),x.end()

int main(){
    int n;
    cin>>n;
    vector< pair< pair<int,string>, int> >  vec;
    for(int i=0;i<n;i++){
        int a,b,c,d,e;
        string S;
        cin>>S;
        for(auto &c:S){
            c='z'-c;
        }
        cin>>a>>b>>c>>d>>e;
        vec.push_back({{a+b+c+d+e,S},i});
    }
    sort(all(vec),greater<pair<pair<int,string>,int>>());
    pair<int,int> ans[n];
    for(int i=0;i<n;i++){
        int sum=vec[i].f.f;
        string S=vec[i].f.s;
        int id=vec[i].s;
        pair<pair<int,string>,int> cur={{sum+500,S},id};
        ans[id].f=(lower_bound(all(vec),cur,greater<pair<pair<int,string>,int>>())-vec.begin())+1;
        cur.f.f-=1000;
        ans[id].s=(lower_bound(all(vec),cur,greater<pair<pair<int,string>,int>>())-vec.begin());
    }
    for(int i=0;i<n;i++){
        cout<<ans[i].f<<' '<<ans[i].s<<'\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct