My issue
Can anyone check my code why it is partially submitting
Let me know why some test cases are not passing
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
//Your code goes here
int t;
cin>>t;
while(t--)
{
unordered_map<int,int>mp;
int N;
cin>>N;
vector<pair<string,int>>res;
for(int i=0;i<N;i++)
{
string a;
int b;
cin>>a>>b;
res.push_back({a,b});
mp[b]++;
}
vector<pair<int,string>>ans;
for(int i=0;i<N;i++)
{
if(mp[res[i].second]==1)
{
ans.push_back({res[i].second,res[i].first});
}
}
sort(ans.begin(),ans.end());
if(ans.size()==0)
{
cout<<"Nobody wins"<<endl;
}
else
{
cout<<ans[0].second<<endl;
}
}
return 0;
}
Problem Link: NUMBERS Problem - CodeChef