QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#568390 | #9320. Find the Easiest Problem | JOFISH | WA | 23ms | 10784kb | C++23 | 1.4kb | 2024-09-16 16:15:57 | 2024-09-16 16:15:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct node{
string a;
char ti;
string result;
}c[100000];
bool cmp(node x, node y){
if(x.a.size() == y.a.size()){
return x.a[x.a.size()-1] > y.a[y.a.size()-1];
} else return x.a.size() > y.a.size();
}
int main(){
int t;
cin >> t;
while(t--){
int n, i;
int *SUM = new int[26]();
int *sum = new int[26]();
cin >> n;
for(i = 0; i < n; i++){
string str, strr;
char qq;
int p = 1;
cin >> c[i].a >> c[i].ti >> c[i].result;
}
sort(c, c+n, cmp);
for(i = 0; i < n; i++){
if(c[i].result == "rejected")continue;
if(i == 0){
for(int j = 0; j < 26; j++){
sum[j] = 0;
}
if(sum[c[i].ti - 'A'] == 0){
SUM[c[i].ti - 'A']++;
sum[c[i].ti - 'A'] = 1;
}
}else {
if(c[i].a == c[i-1].a){
if(sum[c[i].ti - 'A'] == 0){
SUM[c[i].ti - 'A']++;
sum[c[i].ti - 'A'] = 1;
} else continue;
}
if(c[i].a != c[i-1].a){
for(int j = 0; j < 26; j++){
sum[j] = 0;
}
if(sum[c[i].ti - 'A'] == 0){
SUM[c[i].ti - 'A']++;
sum[c[i].ti - 'A'] = 1;
}
}
}
}
int k = 0, l = 0;
for(i = 0; i < 26; i++){
if(SUM[i] > k) {k = SUM[i]; l = i;}
// cout << SUM[i] << endl;
}
char s = l + 'A';
cout << s;
if(t != 0) cout << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 10552kb
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: 23ms
memory: 10784kb
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 P H I B I G H S T J B H R A C R O I P A B I A A N A B A O F A R T B G K E S D F D R C U V O I A O J E A B D M C T L O V H D N E L Q F B G J A E O A A E A K J J S E J Z K F I S P M H L G H W I P T C O P D N B S Y P S G J G Q F F C B B F C O A E I D K I R X N F N L Q L A X I H H J X D K A F B F B H ...
result:
wrong answer 1st lines differ - expected: 'Z', found: 'A'