QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#565312#9320. Find the Easiest ProblemgmapopWA 165ms7492kbC++141.4kb2024-09-15 20:56:372024-09-15 20:56:38

Judging History

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

  • [2024-09-15 20:56:38]
  • 评测
  • 测评结果:WA
  • 用时:165ms
  • 内存:7492kb
  • [2024-09-15 20:56:37]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define x first 
#define y second

const int N=1e5+10;

int n;
int a[N];

void solve(int W)
{
    int n;
    cin >> n;
    map<pair<string,string>,int> Hash;
    unordered_map<string,int> Hash2;
    unordered_map<int,string> Hash3;
    vector<int> T(1e6);
    
    int u=0;
    for(int i=0;i<n;i++) {
        string s1,s2,s3;
        cin >> s1 >> s2 >> s3;
        // cout << "s:" << s1 << " " << s2 << " " << s3 << endl;
        if(s3=="accepted") {
            if(!Hash2.count(s2)) {
                Hash2[s2]=u;
                Hash3[u]=s2;
                Hash[{s1,s2}]=1;
                T[u]=1;
                u++;
            }else {
                int t=Hash2[s2];
                if(!Hash.count({s1,s2})) {
                    Hash[{s1,s2}]=1;
                    T[t]++;
                }else {

                }
            }
        }
    }
    int max_v=0;
    for(int i=0;i<u;i++) {
        // cout << "T:" << T[i] << endl;
        max_v=max(max_v,T[i]);
    }
    char ans='Z';
    for(int i=0;i<u;i++) {
        if(T[i]==max_v) {
            char c=Hash3[i][0];
            if(c<ans) {
                ans=c;
            }
        }
    }
    if(W==1) cout << ans << endl;
    else cout << ans;
}

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        solve(T);
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 7476kb

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: 165ms
memory: 7492kb

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:

ZEZIBIGHSKJIHRZCKOIPABIAANABAOFORTHGKESDFDRCUVWPAOJEABUMCTLGVAZNEOQFBGJIEMAAEAKJJSEWZKFISPMHGGHWIPTDOAFNCSYZSGJFQFOCBBUCIAEIPKCRXNDNLQLIXIHUJZDKGFTFBHZCKMRBHXRAAIXBIBACJJABDGAQGMCEDMEBCLHAQBAGBQCJCNJAHEGFCAJHAKLKSOWGEBYVOZAAPBKGBXSECFKCJHRMXHGRCBISJAYLOPYQBKHYLDQAAFXDANTVGBEFGDHIAEBACFBAGTLEXOCCHREF...

result:

wrong answer 1st lines differ - expected: 'Z', found: 'ZEZIBIGHSKJIHRZCKOIPABIAANABAO...CNIAWATBOVARPIATNYLZDCAHHNRYJFC'