Submission #1150379

#TimeUsernameProblemLanguageResultExecution timeMemory
1150379ahmetlbktd4Med (COCI22_med)C++20
0 / 50
0 ms392 KiB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	string s;
	vector <pair<int,string>> a;
	for (int i = 0;i < n;i++){
		int f,b,c,d,e;
		cin >> s;
		cin >> f >> b >> c >> d >> e;
		a.push_back({f+b+c+d+e,s});
	}
	sort(a.begin(),a.end(),[](pair<int,string> &c,pair<int,string> &b){
		if (c.f == b.f)
		return c.s<b.s;
		return c.f>b.f;
	});
	for (int i = 0;i < n;i++){
		int k = a[i].f-500,l=0;
		for (int j = 0;j < n;j++){
			if (a[j].f > k)
			l++;
		}		
		int h = a[i].f+500,p = 0;
		for (int j = n-1;j >= 0;j--){
			if (a[j].f < h)
			p++;
		}
		cout << n-p+1 << " " << l << "\n";
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...