QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#585064#9320. Find the Easiest ProblemBerryPieWA 26ms8548kbC++201.3kb2024-09-23 18:43:052024-09-23 18:43:05

Judging History

你现在查看的是最新测评结果

  • [2024-09-23 18:43:05]
  • 评测
  • 测评结果:WA
  • 用时:26ms
  • 内存:8548kb
  • [2024-09-23 18:43:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int MAXN = 100000+5;
int n, cnt1, cnt2;
string ans;
string ss[MAXN];
vector<int> vec[MAXN];
map<string, int> mp1, mp2;

int find1(string s){
    if(mp1.count(s)){
        return mp1[s];
    }
    return mp1[s] = ++cnt1;
}

int find2(string s){
    if(mp2.count(s)){
        return mp2[s];
    }
    ss[++cnt2] = s;
    return mp2[s] = cnt2;
}

int main(){
    int kase;
    cin >> kase;
    while(kase--){
        cin >> n;
        cnt1 = 0;
        cnt2 = 0;
        mp1.clear();
        mp2.clear();
        for(int i = 0; i < n; i++){
            string s1, s2, s3;
            cin >> s1 >> s2 >> s3;
            if(s3 != "accepted") continue;
            int a = find1(s1);
            int b = find2(s2);
            // cout << a << " " << b << "\n";
            vec[b].push_back(a);
        }
        int mx = 0;
        ans = "";
        for(int i = 1; i <= cnt2; i++){
            sort(vec[i].begin(), vec[i].end());
            vec[i].erase(unique(vec[i].begin(), vec[i].end()), vec[i].end());
            int tmp = vec[i].size();
            if(tmp > mx || (tmp == mx && ss[i] < ans)){
                mx = tmp;
                ans = ss[i];
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 8548kb

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: 26ms
memory: 6812kb

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
C
Z
I
K
B
G
G
V
L
K
A
F
M
A
L
K
A
X
A
Q
B
A
B
C
I
A
B
F
E
A
A
D
C
D
G
B
A
B
B
C
D
A
C
D
A
A
C
A
C
J
A
A
A
A
A
A
B
B
A
A
A
A
A
B
A
C
A
A
G
C
A
E
A
A
A
E
A
B
B
A
B
A
B
A
A
F
B
A
C
C
C
C
A
A
F
A
A
A
A
B
A
B
A
A
A
A
A
A
B
B
A
B
B
A
A
A
A
B
B
A
A
A
B
A
A
B
A
G
B
A
A
G
B
A
A
A
A
B
A
A
A
B
A
A
F
B
A
B
H
...

result:

wrong answer 2nd lines differ - expected: 'E', found: 'C'