QOJ.ac
QOJ
ID | 提交记录ID | 题目 | Hacker | Owner | 结果 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|
#1250 | #780646 | #9549. The Magician | Imakf | Imakf | Success! | 2024-11-25 12:05:43 | 2024-11-25 12:05:44 |
详细
Extra Test:
Wrong Answer
time: 0ms
memory: 3560kb
input:
4 15 AC 2H AH 3D 2D AD 9S 8S 7S 6S 5S 4S 3S 2S AS 1 0 0 0 0 1 21 AC 2H AH 7D 6D 5D 4D 3D 2D AD JS TS 9S 8S 7S 6S 5S 4S 3S 2S AS 1 1 1 0 0 1 28 2C AC 3H 2H AH JD TD 9D 8D 7D 6D 5D 4D 3D 2D AD QS JS TS 9S 8S 7S 6S 5S 4S 3S 2S AS 1 1 0 0 0 0 27 AC 8H 7H 6H 5H 4H 3H 2H AH 9D 8D 7D 6D 5D 4D 3D 2D AD 9S 8...
output:
2 4 5 5
result:
wrong answer 1st lines differ - expected: '3', found: '2'
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#780646 | #9549. The Magician | Imakf | WA | 0ms | 3848kb | C++23 | 4.9kb | 2024-11-25 12:05:19 | 2024-11-25 12:13:13 |
answer
// https://codeforces.com/gym/549776/submission/289362381
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,k;
int t;
int op[10];
unordered_map<char,int> mp;
vector<pair<int,char>> ve;
void dfs(int x){
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>t;
while(t--){
ve.clear();
mp.clear();
int ans=0;
int sum=0;
cin>>n;
string card;
mp['D']=0;
mp['H']=0;
mp['C']=0;
mp['S']=0;
for(int i=1;i<=n;i++){
cin>>card;
mp[card[1]]++;
}
for(int i=1;i<=6;i++){
cin>>op[i];
}
for(auto v:mp){
ans+=v.second/5;
v.second%=5;
sum+=v.second;
ve.push_back({v.second,v.first});
}
if(sum<5){
cout<<ans<<"\n";
continue;
}
for(int i=0;i<ve.size();i++){
if(sum<5)break;
int change=0;
if(ve[i].second=='D'){
if(op[1]){
change+=3;
if(ve[i].first+change>=5){
sum-=5;
ans++;
op[1]=0;
continue;
}
}
if(op[5]){
op[5]=0;
change++;
if(ve[i].first+change>=5){
sum-=5;
op[1]=0;
ans++;
continue;
}
op[5]=1;
}
if((op[5]||ve[i].first)&&op[6]){
change++;
if(ve[i].first+change>=5){
sum-=5;
op[1]=0;
ans++;
continue;
}
}
}
else if(ve[i].second=='C'){
if(op[2]){
change+=3;
if(ve[i].first+change>=5){
sum-=5;
op[2]=0;
ans++;
continue;
}
}
if(op[5]){
op[5]=0;
change++;
if(ve[i].first+change>=5){
sum-=5;
op[1]=0;
ans++;
continue;
}
op[5]=1;
}
if((op[5]||ve[i].first)&&op[6]){
change++;
if(ve[i].first+change>=5){
sum-=5;
op[2]=0;
ans++;
continue;
}
}
}
else if(ve[i].second=='H'){
if(op[3]){
change+=3;
if(ve[i].first+change>=5){
sum-=5;
op[3]=0;
ans++;
continue;
}
}
if(op[5]){
op[5]=0;
change++;
if(ve[i].first+change>=5){
sum-=5;
op[1]=0;
ans++;
continue;
}
op[5]=1;
}
if((op[5]||ve[i].first)&&op[6]){
change++;
if(ve[i].first+change>=5){
sum-=5;
op[3]=0;
ans++;
continue;
}
}
}
else{
if(op[4]){
change+=3;
if(ve[i].first+change>=5){
sum-=5;
op[4]=0;
ans++;
continue;
}
}
if(op[5]){
op[5]=0;
change++;
if(ve[i].first+change>=5){
sum-=5;
op[5]=0;
ans++;
continue;
}
op[5]=1;
}
if((op[5]||ve[i].first)&&op[6]){
change++;
if(ve[i].first+change>=5){
sum-=5;
op[1]=0;
ans++;
continue;
}
}
}
}
cout<<ans<<"\n";
}
return 0;
}