HackerEarth The Best Player problem solution YASH PAL, 31 July 2024 In this HackerEarth The Best Player problem solution It’s Lolympics 2016 right now, and we all know who’s the best player there right now: Kalyani! Obviously, he has a huge female fan following and he has to make sure they are all happy and rooting for him to win the gold medals. But with fan following comes arrogance and lack of time. Thus, he has sufficient time to interact with atmost T of his fans. Each fan is defined by two parameters : Name and Fan Quotient. The name defines the name of the fan, while the fan quotient is a measure of the fan’s devotion towards Kalyani. Higher the fan quotient, greater is the devotion. Kalyani now wants to meet T of his fans. While selecting the fans he wants to meet, he wants to make sure that a fan with a higher fan quotient should be given a chance in favour of those with lesser fan quotient. In case of ties, he sorts their name lexicographically and chooses the lexicographically lesser named fan. Given details of N fans, can you help out Kalyani by giving him a list of fans he would be interacting with? HackerEarth The Best Player problem solution. #include <bits/stdc++.h>using namespace std;typedef long long LL;#define PII pair<int,int>#define all(c) c.begin(),c.end()#define sz(c) (int)c.size()#define clr(c) c.clear()#define pb push_back#define mp make_pair#define cin(x) scanf("%d",&x)#define MOD 1000000007#define EPS 1E-10vector< pair<string,int> > arr;bool cmp(const pair<string,int> &A, const pair<string,int> &B){ return ((A.second > B.second) or (A.second == B.second && A.first < B.first));}bool ok(string &a){ for(auto i: a) if(i >= 'a' && i <= 'z') continue; else return false; return true;}int main(){ int n,t; cin(n); cin(t); assert(1 <= t && t <= n && n <= 1000); arr.resize(n); for(auto &i: arr) { cin >> i.first >> i.second; assert(ok(i.first) && 1 <= i.second && i.second <= 1000000000); } sort(all(arr),cmp); for(int i = 0; i < t; i++) cout << arr[i].first << "n"; return 0;} coding problems