QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#568584 | #9320. Find the Easiest Problem | blackking | RE | 1ms | 3556kb | C++14 | 961b | 2024-09-16 17:12:17 | 2024-09-16 17:12:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
int findpro(string s[],int n,string f){
for(int i=1;i<=n;i++){
if(s[i]==f)return i;
}
return 0;
}
void solve(){
int n;
set<string>sum[11];
string s[11];
int oi=0;
cin>>n;
for(int i=0;i<n;i++){
string team,pro,from;
cin>>team>>pro>>from;
if(from=="rejected")continue;
if(findpro(s,oi,pro)){
sum[findpro(s,oi,pro)].insert(team);
}
else{
oi++;
s[oi]=pro;
sum[findpro(s,oi,pro)].insert(team);
}
}
int maxnum=0;
string maxname;
for(int i=1;i<=n;i++){
if(sum[i].empty())break;
if((int)sum[i].size()>maxnum){
maxnum=sum[i].size();
maxname=s[i];
}
else if((int)sum[i].size()==maxnum&&s[i]<maxname){
maxnum=sum[i].size();
maxname=s[i];
}
}
cout<<maxname<<endl;
}
signed main(){
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
2 5 teamA A accepted teamB B rejected teamC A accepted teamB B accepted teamD C accepted 4 teamA A rejected teamB A accepted teamC B accepted teamC B accepted
output:
A A
result:
ok 2 lines
Test #2:
score: -100
Runtime Error
input:
1000 44 WaiooyIXa O accepted WaiooyIXa P accepted ZYYsNWag P accepted DPIawQg D rejected IzPdjnM Z rejected Ra D rejected kwQyGxLo I rejected DPIawQg L accepted kwQyGxLo I accepted mmWxDuADCB D rejected PXwVAOgwiz P rejected ZYYsNWag U accepted IzPdjnM Z accepted TgBNO P rejected kwQyGxLo J accepted...