QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#570289 | #9320. Find the Easiest Problem | jpphy | WA | 4ms | 3784kb | C++17 | 844b | 2024-09-17 15:10:18 | 2024-09-17 15:10:22 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n, c[26], id[30];
char s[20], p[2], r[30];
void solve(){
map<string, int> mp;
set<int> ts[26];
int tmp;
while(n--){
scanf("%s%s%s", s, p, r);
p[0] -= 'A';
if(r[0] == 'r') continue;
if(mp.count(s) == 0) mp[s] = mp.size();
tmp = mp[s];
if(ts[p[0]].find(tmp) != ts[p[0]].end()){
c[p[0]]++;
ts[p[0]].insert(tmp);
}
}
sort(id, id+27, [](int x, int y){
if(c[x] == c[y]) return x < y;
return c[x] > c[y];
});
printf("%c\n", id[0]+'A');
}
signed main(){
for(int i = 0; i < 26; ++i) id[i] = i;
int t;
scanf("%d", &t);
while(t--){
memset(c, 0, sizeof c);
scanf("%d", &n);
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
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
Wrong Answer
time: 4ms
memory: 3736kb
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:
A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A ...
result:
wrong answer 1st lines differ - expected: 'Z', found: 'A'