QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#596469#5065. Beautiful StringyldWA 0ms5008kbC++201.9kb2024-09-28 15:51:092024-09-28 15:51:10

Judging History

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

  • [2024-09-28 15:51:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5008kb
  • [2024-09-28 15:51:09]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
void solve()
{
    int n,m;
    cin>>n>>m;
    vector<int> a,b;
    int p;
    auto change=[&](char x)
    {
        if(x=='A') return 13;
        else if(x=='T') return 9;
        else if(x=='K') return 12;
        else if(x=='Q') return 11;
        else if(x=='J') return 10;
        else return x-'0'-1;
    };
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        a.push_back(change(s[0]));
    }
    for(int i=1;i<=m;i++)
    {
        string s;
        cin>>s;
        b.push_back(change(s[0]));
    }
    sort(b.begin(),b.end());
    string s;
    cin>>s;
    p=change(s[0]);
    if(n==1) cout<<"Shou\n";
    else if(m==1)
    {
        int flag=0;
        for(auto x:a)
            if(x<p && x>=b[0]) flag=1;
        if(flag) cout<<"Pang\n";
        else cout<<"Shou\n";
    }
    else
    {
        int num=0,flag=0;
        for(auto x:a)
        {
            if(x<p) flag=1;
        }
        for(auto x:b)
        {
            if(x<p) num++;
        }
        if(!flag || !num) cout<<"Shou\n";
        else if(num>=2) cout<<"Pang\n";
        else
        {
            int maxa=0,maxb=0;
            int numa=0;
            for(auto x:a)
            {
                maxa=max(maxa,x);
                if(x<p) numa++;
            }
            for(auto x:b) maxb=max(maxb,x);
            if(maxa>maxb && numa>=2)
            {
                int maxn=0;
                for(auto x:a)
                    if(x<p) maxn=max(maxn,x);
                if(maxn>=b[0]) cout<<"Pang\n";
                else cout<<"Shou\n";
            }
            else cout<<"Shou\n";
        }
    }
}
signed main()
{
    cin.tie(0)->sync_with_stdio(0);
    int t=1;
    cin>>t;
    while(t--) solve(); 
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5008kb

input:

2
114514
0000000

output:

Shou
Shou

result:

wrong output format Expected integer, but "Shou" found