Submission #799196

# Submission time Handle Problem Language Result Execution time Memory
799196 2023-07-31T10:40:17 Z MercubytheFirst Med (COCI22_med) C++17
50 / 50
1 ms 340 KB
/*


*/

#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<set>
#include<climits>
#include<numeric>
#include<queue>
#include<unordered_map>
#include<string>
#include<climits>
#include<unordered_set>
#include<bitset>
#include<cstring>
#include<cmath>
#include<stack>

#define st first
#define nd second
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
using namespace std;


bool comp(const pair<int, string>& a, const pair<int, string>& b){
    if(a.st > b.st)return true;
    if(a.st < b.st)return false;
    return a.nd < b.nd;
}

void solve(){
    int n;
    cin >> n;
    vector<pair<int, string> >vo(n), vmax(n), vmin(n);
    for(int i = 0; i < n; ++i){
        cin >> vo[i].nd;
        vo[i].st = 0;
        int x, cnt = 5;
        while(cnt--){
            cin >> x;
            vo[i].st += x;
        }
        vmax[i] = vmin[i] = vo[i];
        vmax[i].st += 500;
    }
    sort(vmax.begin(), vmax.end(), comp);
    sort(vmin.begin(), vmin.end(), comp);
    cout << endl;
    
    for(int i = 0; i < n; ++i){
        int worst = lower_bound(vmax.begin(), vmax.end(), vo[i], comp) - vmax.begin();
        vo[i].st += 500;
        int best = lower_bound(vmin.begin(), vmin.end(), vo[i], comp) - vmin.begin();
        best++;
        cout << best << ' ' << worst << endl;


    }
}

signed main(){
    //fileio("test");
    fio; 
    //int t;cin >> t;while(t--)
        solve();

}


/*

*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 316 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 324 KB Output is correct