답안 #704843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704843 2023-03-03T05:22:13 Z Cookie197 Med (COCI22_med) C++17
50 / 50
10 ms 340 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define endl "\n"
#define mp make_pair
#define out(x) cout << #x << " = " << x << endl

pair<int,string> a[505];
int n;
bool smaller(pair<int,string> x,pair<int,string> y){
    if (x.first < y.first) return true;
    else if (x.first > y.first) return false;
    if (x.second > y.second) return true;
    return false;
}
signed main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>a[i].second;
        for (int z=0;z<5;z++){
            int x; cin>>x; a[i].first += x;
        }
    }

    for (int i=1;i<=n;i++){
        a[i].first += 500;
        int ans1 = 1;
        for (int j=1;j<=n;j++) if (j!=i){
            if (smaller(a[i], a[j])) ans1++;
        }
        a[i].first -= 1000;
        int ans2 = 1;
        for (int j=1;j<=n;j++) if (j!=i){
            if (smaller(a[i], a[j])) ans2++;
        }
        cout<<ans1<<" "<<ans2<<endl;
        a[i].first += 500;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 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 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 9 ms 340 KB Output is correct
7 Correct 6 ms 340 KB Output is correct
8 Correct 10 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct