QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#570399 | #9320. Find the Easiest Problem | viliant | TL | 0ms | 3760kb | C++14 | 996b | 2024-09-17 15:39:27 | 2024-09-17 15:39:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int t,n,i;
cin >> t;
cin >> n;
set<pair<string,char>> s;//利用set存储"acccept"的队名和题目,可自动去重
vector<int> count(26,0);
multiset<char> pro;//利用set存储各队ac题号,可自动排序
while(t--){
for(i = 0;i < n;i++){
string team,result; char problem;
cin >> team >> problem >> result;
if(result == "accepted"){
s.insert(make_pair(team,problem));
};
};
vector<pair<string,char>> v(s.begin(),s.end());//从set copy到vector中进行下标索引
for(i = 0;i < v.size();i++){
char problem = v[i].second;
pro.insert(problem);
};
vector<char> p(pro.begin(),pro.end()); //
for(i = 0;i < p.size();i++){
count[p[i] - 'A']++;
};
int m = 0;
for(i = 0;i < count.size();i++){
m = max(count[i],m);
}
for(i = 0;i < count.size();i++){
if(count[i] == m){
cout << (char)(i + 'A') << endl;
break;
}
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3760kb
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
Time Limit Exceeded
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...
output:
Z P P P P P P P P P P P P P P P P P P Z Z H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H ...