답안 #1089889

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1089889 2024-09-17T11:13:42 Z Onur_Ilgaz Med (COCI22_med) C++17
50 / 50
1 ms 396 KB
#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";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 396 KB Output is correct
9 Correct 0 ms 348 KB Output is correct