QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#596469 | #5065. Beautiful String | yld | WA | 0ms | 5008kb | C++20 | 1.9kb | 2024-09-28 15:51:09 | 2024-09-28 15:51:10 |
Judging History
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