Submission #1137362

#TimeUsernameProblemLanguageResultExecution timeMemory
1137362jackofall718Med (COCI22_med)C++20
50 / 50
1 ms328 KiB
//COCI 2021-22 ROUND 6 PROBLEM 1
#include <bits/stdc++.h>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
using namespace std;

int32_t main(){
	fast
	int n;
	cin >> n;
	vector <pair<int, string> > v(n);
	for(int i = 0; i < n; i++) {
		cin >> v[i].second;
		for(auto &it:v[i].second) {
			it = 'z' - it + 'a';
		}
		int sum = 0;
		for(int j = 0; j < 5; j++) {
			int in;
			cin >> in;
			sum += in;
		}
		v[i].first = sum;
	}
	auto worst = v;
	auto best = v;
	for(auto &it:best) {
		it.first += 500;
	}
	sort(worst.begin(), worst.end());
	sort(best.begin(), best.end());
	for(auto it:v) {
		// for worst
		pair<int, int> find;
		find.second = n - (upper_bound(best.begin(), best.end(), it) - best.begin());
		// for best
		it.first += 500;
		find.first = n - (upper_bound(worst.begin(), worst.end(), it) - worst.begin()) + 1;
		cout << find.first << " " << find.second << "\n";
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...