QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#568382 | #9320. Find the Easiest Problem | JOFISH | WA | 3ms | 10644kb | C++23 | 1.6kb | 2024-09-16 16:14:38 | 2024-09-16 16:14:41 |
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++){
cout << c[i].a << endl;
}
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;
}
//1
//9
//a A accepted
//b B accepted
//c A accepted
//a B accepted
//a C accepted
//b B accepted
//c C accepted
//c B accepted
//c C accepted
详细
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 10644kb
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:
teamD teamC teamB teamB teamA A teamC teamC teamB teamA A
result:
wrong answer 1st lines differ - expected: 'A', found: 'teamD'