답안 #799127

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799127 2023-07-31T10:00:47 Z elotelo966 Med (COCI22_med) C++17
50 / 50
27 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000005
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
#define mod 1000000007
vector <pair<int,string>> v;

int32_t main(){
    faster
    int n;cin>>n;
    for(int i=0;i<n;i++){
        string s;cin>>s;
        int deg,sum=0;
        for(int j=0;j<5;j++){
            cin>>deg;
            sum+=deg;
        }
        v.push_back({-sum,s});
    }
    for(int i=0;i<n;i++){
        vector <pair<int,string>> deg=v;
        string isim=deg[i].second;
        for(int j=0;j<n;j++){
            if(deg[j].second==isim){
                deg[j].first-=500;
            }
        }
        sort(deg.begin(),deg.end());
       // reverse(deg.begin(),deg.end());
        for(int j=0;j<n;j++){
            if(deg[j].second==isim){
                cout<<j+1<<" ";
            }
        }
        for(int j=0;j<n;j++){
            if(isim==deg[j].second){
                deg[j].first+=500;
            }
            else deg[j].first-=500;
        }
        sort(deg.begin(),deg.end());
       // reverse(deg.begin(),deg.end());
        for(int j=0;j<n;j++){
            if(deg[j].second==isim){
                cout<<j+1<<'\n';
            }
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 11 ms 376 KB Output is correct
6 Correct 21 ms 340 KB Output is correct
7 Correct 13 ms 340 KB Output is correct
8 Correct 27 ms 340 KB Output is correct
9 Correct 7 ms 340 KB Output is correct