QOJ.ac

QOJ

IDSubmission IDProblemHackerOwnerResultSubmit timeJudge time
#1249#780615#9549. The MagicianImakfImakfSuccess!2024-11-25 11:53:262024-11-25 11:53:26

Details

Extra Test:

Wrong Answer
time: 0ms
memory: 3560kb

input:

3
34
5C 4C 3C 2C AC 7H 6H 5H 4H 3H 2H AH JD TD 9D 8D 7D 6D 5D 4D 3D 2D AD JS TS 9S 8S 7S 6S 5S 4S 3S 2S AS
0 1 1 0 0 0
19
AC 5H 4H 3H 2H AH 6D 5D 4D 3D 2D AD 7S 6S 5S 4S 3S 2S AS
0 1 0 1 1 1
31
2C AC 7H 6H 5H 4H 3H 2H AH TD 9D 8D 7D 6D 5D 4D 3D 2D AD QS JS TS 9S 8S 7S 6S 5S 4S 3S 2S AS
0 0 0 0 1 1

output:

6
3
6

result:

wrong answer 3rd lines differ - expected: '5', found: '6'

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#780615#9549. The MagicianImakfWA 0ms3856kbC++231.3kb2024-11-25 11:53:082024-11-25 12:00:00

answer

// https://codeforces.com/gym/105540/submission/292805531
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define f first 
#define s second 

void sol(){
    
    int n,r=0,t[6],c[4]={0,0,0,0},ct=0,f=0,f2,v[4]={0,0,0,0};
    string s;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s[1]=='D')c[0]++;
        if(s[1]=='C')c[1]++;
        if(s[1]=='H')c[2]++;
        if(s[1]=='S')c[3]++;
    }
    for(int i=0;i<6;i++)cin>>t[i];
    for(int i=0;i<4;i++)
        r+=c[i]/5,c[i]%=5,ct+=c[i];
    if(ct<5)cout<<r<<"\n";
    else if(ct<10){
        for(int i=0;i<5;i++)f|=(5<=c[i]+t[i]*3+t[4]+t[5]);
        cout<<r+f<<"\n";
    }else if(ct<15){
        f2=0;
        for(int i=0;i<4;i++){
            ct=t[4]+t[5];
            if(5<=c[i]+t[i]*3+ct){
                ct=min(ct,c[i]+t[i]*3+ct-5);
                f2=max(f2,1);
                for(int j=0;j<4;j++){
                    if(i!=j&&5<=c[j]+t[j]*3+ct){
                        f2=2;
                    }
                }
            }
        }
        cout<<r+f2<<"\n";
    }else{
        for(int i=0;i<6;i++)f+=t[i];
        cout<<r+min(3,f)<<"\n";
    }
}

int main(){
    cin.tie(0)->sync_with_stdio(0);
    int t;cin>>t;while(t--)
    sol();
}