Submission #704843

#TimeUsernameProblemLanguageResultExecution timeMemory
704843Cookie197Med (COCI22_med)C++17
50 / 50
10 ms340 KiB
#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;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...