QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#756806#9549. The Magicianucup-team1134#AC ✓961ms177668kbC++238.6kb2024-11-16 22:01:192024-11-20 18:13:10

Judging History

你现在查看的是测评时间为 2024-11-20 18:13:10 的历史记录

  • [2024-11-27 17:57:46]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:963ms
  • 内存:184004kb
  • [2024-11-27 17:55:10]
  • hack成功,自动添加数据
  • (/hack/1262)
  • [2024-11-26 23:03:13]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:958ms
  • 内存:177640kb
  • [2024-11-26 22:59:39]
  • hack成功,自动添加数据
  • (/hack/1259)
  • [2024-11-25 12:09:47]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:980ms
  • 内存:177652kb
  • [2024-11-25 12:05:56]
  • hack成功,自动添加数据
  • (/hack/1250)
  • [2024-11-25 11:57:03]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:964ms
  • 内存:177652kb
  • [2024-11-25 11:53:37]
  • hack成功,自动添加数据
  • (/hack/1249)
  • [2024-11-25 11:38:28]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:952ms
  • 内存:177620kb
  • [2024-11-25 11:33:10]
  • hack成功,自动添加数据
  • (/hack/1247)
  • [2024-11-25 11:28:32]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:961ms
  • 内存:177660kb
  • [2024-11-25 11:23:45]
  • hack成功,自动添加数据
  • (/hack/1246)
  • [2024-11-25 11:09:41]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:950ms
  • 内存:177656kb
  • [2024-11-25 11:04:42]
  • hack成功,自动添加数据
  • (/hack/1245)
  • [2024-11-23 19:33:20]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:949ms
  • 内存:177656kb
  • [2024-11-23 19:31:45]
  • hack成功,自动添加数据
  • (/hack/1244)
  • [2024-11-21 22:07:38]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:979ms
  • 内存:180796kb
  • [2024-11-21 22:06:48]
  • hack成功,自动添加数据
  • (/hack/1231)
  • [2024-11-21 22:04:14]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:956ms
  • 内存:177632kb
  • [2024-11-21 22:03:20]
  • hack成功,自动添加数据
  • (/hack/1230)
  • [2024-11-21 21:56:39]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:966ms
  • 内存:177688kb
  • [2024-11-21 21:55:33]
  • hack成功,自动添加数据
  • (/hack/1229)
  • [2024-11-21 21:38:16]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:963ms
  • 内存:183856kb
  • [2024-11-21 21:37:18]
  • hack成功,自动添加数据
  • (/hack/1228)
  • [2024-11-21 21:26:55]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:981ms
  • 内存:177640kb
  • [2024-11-21 21:26:05]
  • hack成功,自动添加数据
  • (/hack/1227)
  • [2024-11-21 19:13:57]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:960ms
  • 内存:180592kb
  • [2024-11-21 19:12:41]
  • hack成功,自动添加数据
  • (/hack/1225)
  • [2024-11-21 19:07:20]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:959ms
  • 内存:177676kb
  • [2024-11-21 19:05:51]
  • hack成功,自动添加数据
  • (/hack/1224)
  • [2024-11-21 18:31:53]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:959ms
  • 内存:177676kb
  • [2024-11-21 18:30:17]
  • hack成功,自动添加数据
  • (/hack/1223)
  • [2024-11-21 18:15:09]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:967ms
  • 内存:177680kb
  • [2024-11-21 18:12:40]
  • hack成功,自动添加数据
  • (/hack/1222)
  • [2024-11-21 17:40:55]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:958ms
  • 内存:177668kb
  • [2024-11-21 17:36:20]
  • hack成功,自动添加数据
  • (/hack/1221)
  • [2024-11-20 19:20:39]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:955ms
  • 内存:177684kb
  • [2024-11-20 19:16:22]
  • hack成功,自动添加数据
  • (/hack/1216)
  • [2024-11-20 18:13:10]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:961ms
  • 内存:177668kb
  • [2024-11-20 18:08:54]
  • hack成功,自动添加数据
  • (/hack/1215)
  • [2024-11-20 13:49:20]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:956ms
  • 内存:177684kb
  • [2024-11-20 13:45:08]
  • hack成功,自动添加数据
  • (/hack/1202)
  • [2024-11-16 22:01:21]
  • 评测
  • 测评结果:100
  • 用时:965ms
  • 内存:177680kb
  • [2024-11-16 22:01:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;

int dp[1<<6][23][23][23][23][4];

int f(int a,int b,int c,int d){
    return a/5+b/5+c/5+d/5;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    for(int S=0;S<(1<<6);S++){
        for(int a=0;a<=17;a++){
            for(int b=0;b<=17;b++){
                for(int c=0;c<=17;c++){
                    for(int d=0;d<=17;d++){
                        for(int e=0;e<3;e++){
                            bool da=false;
                            for(int k=0;k<3;k++){
                                if((!(S&(1<<k)))&&(S&(1<<(k+1)))){
                                    if(k==0){
                                        chmax(dp[S][a][b][c][d][e],dp[S^(1<<k)^(1<<(k+1))][b][a][c][d][e]);
                                        da=true;
                                    }
                                    if(k==1){
                                        chmax(dp[S][a][b][c][d][e],dp[S^(1<<k)^(1<<(k+1))][a][c][b][d][e]);
                                        da=true;
                                    }
                                    if(k==2){
                                        chmax(dp[S][a][b][c][d][e],dp[S^(1<<k)^(1<<(k+1))][a][b][d][c][e]);
                                        da=true;
                                    }
                                }
                            }
                            if(da) continue;
                            if(e==0){
                                chmax(dp[S][a][b][c][d][e],f(a,b,c,d));
                            }
                            if(e==1){
                                chmax(dp[S][a][b][c][d][e],f(a+1,b,c,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b+1,c,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b,c+1,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b,c,d+1));
                            }
                            if(e==2){
                                chmax(dp[S][a][b][c][d][e],f(a+2,b,c,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b+2,c,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b,c+2,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b,c,d+2));
                                
                                chmax(dp[S][a][b][c][d][e],f(a+1,b+1,c,d));
                                chmax(dp[S][a][b][c][d][e],f(a+1,b,c+1,d));
                                chmax(dp[S][a][b][c][d][e],f(a+1,b,c,d+1));
                                chmax(dp[S][a][b][c][d][e],f(a,b+1,c+1,d));
                                chmax(dp[S][a][b][c][d][e],f(a,b+1,c,d+1));
                                chmax(dp[S][a][b][c][d][e],f(a,b,c+1,d+1));
                            }
                            
                            if(S&(1<<0)){
                                for(int x=0;x<=3;x++){
                                    for(int y=0;y<=3&&x+y<=3;y++){
                                        for(int z=0;z<=3&&x+y+z<=3;z++){
                                            if(x+y+z<=3&&x<=b&&y<=c&&z<=d){
                                                chmax(dp[S][a][b][c][d][e],dp[S^(1<<0)][a+x+y+z][b-x][c-y][d-z][e]);
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if(S&(1<<1)){
                                for(int x=0;x<=3;x++){
                                    for(int y=0;y<=3&&x+y<=3;y++){
                                        for(int z=0;z<=3&&x+y+z<=3;z++){
                                            if(x+y+z<=3&&x<=a&&y<=c&&z<=d){
                                                chmax(dp[S][a][b][c][d][e],dp[S^(1<<1)][a-x][b+x+y+z][c-y][d-z][e]);
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if(S&(1<<2)){
                                for(int x=0;x<=3;x++){
                                    for(int y=0;y<=3&&x+y<=3;y++){
                                        for(int z=0;z<=3&&x+y+z<=3;z++){
                                            if(x+y+z<=3&&x<=a&&y<=b&&z<=d){
                                                chmax(dp[S][a][b][c][d][e],dp[S^(1<<2)][a-x][b-y][c+x+y+z][d-z][e]);
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if(S&(1<<3)){
                                for(int x=0;x<=3;x++){
                                    for(int y=0;y<=3&&x+y<=3;y++){
                                        for(int z=0;z<=3&&x+y+z<=3;z++){
                                            if(x+y+z<=3&&x<=a&&y<=b&&z<=c){
                                                chmax(dp[S][a][b][c][d][e],dp[S^(1<<3)][a-x][b-y][c-z][d+x+y+z][e]);
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if(S&(1<<4)){
                                if(a) chmax(dp[S][a][b][c][d][e],dp[S^(1<<4)][a-1][b][c][d][e+1]);
                                if(b) chmax(dp[S][a][b][c][d][e],dp[S^(1<<4)][a][b-1][c][d][e+1]);
                                if(c) chmax(dp[S][a][b][c][d][e],dp[S^(1<<4)][a][b][c-1][d][e+1]);
                                if(d) chmax(dp[S][a][b][c][d][e],dp[S^(1<<4)][a][b][c][d-1][e+1]);
                            }
                            
                            if(S&(1<<5)){
                                if(e){
                                    if(a) chmax(dp[S][a][b][c][d][e],dp[S^(1<<5)][a-1][b][c][d][e+1]);
                                    if(b) chmax(dp[S][a][b][c][d][e],dp[S^(1<<5)][a][b-1][c][d][e+1]);
                                    if(c) chmax(dp[S][a][b][c][d][e],dp[S^(1<<5)][a][b][c-1][d][e+1]);
                                    if(d) chmax(dp[S][a][b][c][d][e],dp[S^(1<<5)][a][b][c][d-1][e+1]);
                                }else{
                                    
                                    for(int s=0;s<4;s++){
                                        for(int t=0;t<4;t++){
                                            if(s==t) continue;
                                            vi U={a,b,c,d};
                                            if(U[s]>0){
                                                U[s]--;
                                                U[t]++;
                                                chmax(dp[S][a][b][c][d][e],dp[S^(1<<5)][U[0]][U[1]][U[2]][U[3]][e]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    int Q;cin>>Q;
    while(Q--){
        int N;cin>>N;
        vi U(4);
        string ty="DCHS";
        for(int i=0;i<N;i++){
            string Z;cin>>Z;
            for(int j=0;j<4;j++){
                if(Z[1]==ty[j]) U[j]++;
            }
        }
        int S=0;
        for(int i=0;i<6;i++){
            int x;cin>>x;
            if(x) S|=(1<<i);
        }
        cout<<dp[S][U[0]][U[1]][U[2]][U[3]][0]<<"\n";
    }
}



这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 929ms
memory: 177372kb

input:

4
5
2H 3H 4H 5H 6D
1 1 1 1 0 0
5
2S 3S 4D 5C 6D
0 0 1 0 1 1
5
2S 3S 4D 5C 6D
0 0 1 0 1 0
13
AS 2S 3S 4S 5H 6H 7H 8H 9H TH JH QH KH
0 0 0 0 0 1

output:

1
1
0
2

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 940ms
memory: 177320kb

input:

13
10
AD 2D 3D 4D 5D 6D 7D 8D 9D TD
0 0 1 0 0 0
10
AH 2D 3D 4D 5D 6D 7D 8D 9D TD
0 0 1 0 0 0
10
AH 2H 3D 4D 5D 6D 7D 8D 9D TD
0 0 1 0 0 0
10
AH 2H 3H 4D 5D 6D 7D 8D 9D TD
0 0 1 0 0 0
10
AH 2H 3H 4H 5D 6D 7D 8D 9D TD
0 0 1 0 0 0
10
AS 2S 3S 4S 5S 6S 7S 8S 9S TS
0 1 0 0 0 0
10
AC 2S 3S 4S 5S 6S 7S 8S ...

output:

2
1
2
2
2
2
1
2
2
2
0
0
0

result:

ok 13 lines

Test #3:

score: 0
Accepted
time: 943ms
memory: 177368kb

input:

2
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JC JS QH QD QC QS KH KD KC KS
1 1 1 1 1 1
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH J...

output:

10
10

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 948ms
memory: 177372kb

input:

9
12
2H TH 4C QC JH JC 8D KC 3C 6H TC 9S
0 0 0 1 0 0
11
5S 2C TH 8S JD 2S 7D AH 4S AC TS
1 0 0 0 0 0
11
QC 4C 5S QS 9H 5H 6H 7H 3D 7D 8D
1 1 1 0 1 1
11
AS AD 3D 8C 5H 2S JC 6C 8H QD JS
0 1 0 0 0 1
11
KC TH 4S 2H 8S 9S QC 3S AD KS 5D
0 0 1 0 0 1
12
4D 5H 6C 3D KH KS 3S 7S TC 4S 4C JS
0 1 0 1 1 0
12
J...

output:

1
2
2
1
2
2
2
2
2

result:

ok 9 lines

Test #5:

score: 0
Accepted
time: 924ms
memory: 177436kb

input:

10
10
5S 6S 4S 2D JD 3H JH 2H 4H 2C
1 1 0 1 0 0
11
3H 2D 6D 7S KD 6C 8H 2S 9H KH 3D
0 1 0 1 0 1
11
4D AH TS 6S TC 3S 9C 3C 5S JH TD
0 1 0 1 0 0
10
9H 3S TC TS 8S 6S TH 7D TD 5D
0 0 0 0 0 1
11
5H KS QH 4D 8H 6H QC 7H 8D JS JC
0 0 1 0 0 0
10
AD 5D TC 8D 5C 5S 8S QS 3C JD
0 0 0 1 0 1
10
TC TH 4S 8C JC ...

output:

2
2
2
1
1
2
2
1
2
2

result:

ok 10 lines

Test #6:

score: 0
Accepted
time: 913ms
memory: 177404kb

input:

2
52
4S 5H AD 9D 9C 4C 9S QD 2C JS 2D 3S 3D AC QS 5S KD 4D KH 9H TC 6C 6S 7D 7C KS 3H 6H KC JC AH 8H QH 3C QC TS 8C TH TD 4H 7S 6D 8S AS 5C JD JH 2H 5D 2S 8D 7H
0 0 0 1 1 1
52
9S JC 8S 2D 2S TS 4C 2C 6D KS 5H KD AH 5D 8C KC QH 6C 4D 9C 8H 5C 3H JH TD QS AC AS QC 6H 4H 7D QD 9D TH 4S 2H JD TC JS 7C A...

output:

10
10

result:

ok 2 lines

Test #7:

score: 0
Accepted
time: 961ms
memory: 177372kb

input:

3
35
9H JC 2H TH 7S 6D AS 4H 3D AD KS TS 2C 9S 5D 8H KD TC KH 5C QD 4S 3C 6C JS AC 2D JD 3H QH 9D 5S 6S JH 5H
0 1 0 0 1 0
34
TS 2H 4H 9D KD JC QS 6C 2D QD 2S JS 7C JH 7H 8H 4S 3C AD QC AS 7D KC 8S 2C 3S 8C 5D 5C AC TD 3H 4C 9H
0 1 1 1 0 0
35
6C 9H 3D TC 4D 3H 2S 8D AS JD 6H 2C 5D QH TD 9D 3S 5C 9C A...

output:

7
6
5

result:

ok 3 lines

Test #8:

score: 0
Accepted
time: 945ms
memory: 177376kb

input:

10
10
AC 7C 9S KD 4S 2C 2S 3D 6D 7H
1 1 0 1 0 1
10
9D AS 8S JS 6C KS 4D 3D 2S QC
0 1 0 0 0 0
10
QC 5H 5D 2S 7S 8S 3D 8C TS 8H
1 0 1 1 0 1
10
KD 7D 8S TC 3S 6C AS 4C 9H KC
1 0 0 0 0 0
11
8C 2C JS 6C QC 2H 5C 9H 3C AS 9D
1 0 1 0 1 0
10
8H 5D 5C QH JS JC 6H 4H 8C 7C
0 0 0 1 1 0
13
9H 4S 8D 3H KD TC 2D ...

output:

2
2
2
1
2
1
1
2
1
1

result:

ok 10 lines

Test #9:

score: 0
Accepted
time: 934ms
memory: 177668kb

input:

13
5
TH JH QD KD AD
1 0 0 0 0 0
5
TH JH QC KC AC
1 0 0 0 0 0
5
TH JH QS KS AS
1 0 0 0 0 0
5
TD JD QH KH AH
1 0 0 0 0 0
5
TD JD QC KC AC
1 0 0 0 0 0
5
TD JD QS KS AS
1 0 0 0 0 0
5
TC JC QH KH AH
1 0 0 0 0 0
5
TC JC QD KD AD
1 0 0 0 0 0
5
TC JC QS KS AS
1 0 0 0 0 0
5
TS JS QH KH AH
1 0 0 0 0 0
5
TS JS...

output:

1
0
0
1
1
1
0
1
0
0
1
0
8

result:

ok 13 lines

Test #10:

score: 0
Accepted
time: 941ms
memory: 177324kb

input:

13
5
TH JH QD KD AD
0 1 0 0 0 0
5
TH JH QC KC AC
0 1 0 0 0 0
5
TH JH QS KS AS
0 1 0 0 0 0
5
TD JD QH KH AH
0 1 0 0 0 0
5
TD JD QC KC AC
0 1 0 0 0 0
5
TD JD QS KS AS
0 1 0 0 0 0
5
TC JC QH KH AH
0 1 0 0 0 0
5
TC JC QD KD AD
0 1 0 0 0 0
5
TC JC QS KS AS
0 1 0 0 0 0
5
TS JS QH KH AH
0 1 0 0 0 0
5
TS JS...

output:

0
1
0
0
1
0
1
1
1
0
0
1
8

result:

ok 13 lines

Test #11:

score: 0
Accepted
time: 931ms
memory: 177372kb

input:

13
5
TH JH QD KD AD
0 0 1 0 0 0
5
TH JH QC KC AC
0 0 1 0 0 0
5
TH JH QS KS AS
0 0 1 0 0 0
5
TD JD QH KH AH
0 0 1 0 0 0
5
TD JD QC KC AC
0 0 1 0 0 0
5
TD JD QS KS AS
0 0 1 0 0 0
5
TC JC QH KH AH
0 0 1 0 0 0
5
TC JC QD KD AD
0 0 1 0 0 0
5
TC JC QS KS AS
0 0 1 0 0 0
5
TS JS QH KH AH
0 0 1 0 0 0
5
TS JS...

output:

1
1
1
1
0
0
1
0
0
1
0
0
8

result:

ok 13 lines

Test #12:

score: 0
Accepted
time: 958ms
memory: 177372kb

input:

13
5
TH JH QD KD AD
0 0 0 1 0 0
5
TH JH QC KC AC
0 0 0 1 0 0
5
TH JH QS KS AS
0 0 0 1 0 0
5
TD JD QH KH AH
0 0 0 1 0 0
5
TD JD QC KC AC
0 0 0 1 0 0
5
TD JD QS KS AS
0 0 0 1 0 0
5
TC JC QH KH AH
0 0 0 1 0 0
5
TC JC QD KD AD
0 0 0 1 0 0
5
TC JC QS KS AS
0 0 0 1 0 0
5
TS JS QH KH AH
0 0 0 1 0 0
5
TS JS...

output:

0
0
1
0
0
1
0
0
1
1
1
1
8

result:

ok 13 lines

Test #13:

score: 0
Accepted
time: 922ms
memory: 177384kb

input:

2
52
4S 7H 3C JH 3H 2H 6H 2D 8C 6S 5H KC 8S TC JS 2C 7S 6D TD 2S 9S TS 3D 9D JD 5D 8H KS AC TH 5S JC 9C 4D QC QD 6C AS 3S 7C KD 8D AH KH 7D 4H 4C 5C AD QS 9H QH
0 0 0 1 0 0
52
6D 7C 5H 2S 9S 9C TS 4H 6H 3S QS KC KH KD 5S 4C 8D 3D JD TC 8H 6C QH KS QC 3H 2H AS 9D 3C 7H 8S TD AD 9H JS TH 7S 5C 4S JC J...

output:

9
9

result:

ok 2 lines

Test #14:

score: 0
Accepted
time: 898ms
memory: 177428kb

input:

3
36
TH 6D JC 7C TS 8S 6H 6S AS 4C 8H TD 4D JD KS 5S 5D 7S 7D 2S AH KD JH 3S 2C 5C 9C 8D QS 9D 4S 9S JS 6C AD 3C
0 0 0 0 1 1
34
JD 7C 5S 9S KD 2D KH 4C 8C 3S 6C 4D 5H TC 5C 7H QC 6S 9D 9H 6H 6D 3D 8D 3H 8H 2C KS 7D JH 2S JC 3C QD
0 0 1 1 0 0
34
KC 6D 5S TD 2D 4D AD QH 2C 6H 5C QD 8H 8S 2H TH 4H AS J...

output:

7
6
6

result:

ok 3 lines

Test #15:

score: 0
Accepted
time: 953ms
memory: 177436kb

input:

4
26
KH JH 2S 9S 3S QS KD 8D QD TH TC 2D JS 5D 7S 8S 9D 4D JD AD 2C KC 3H 8H 3D 6C
0 0 1 0 1 1
26
QH 7D AC 7S 6C 4D 4S 8D 7H 8S 6S 3H AS 6H 5H TC 5C 6D 8H KC QC JH 2C 2H TH 9C
0 0 0 0 0 0
26
TC 6C TD 2S 6H 9S 4D AS 3D AD 5D KC 7H KD JH TS TH QC 5S JD 7S 2D KS QH 5H 7D
1 0 0 0 0 0
26
TC 2C 9D KH 8H 7...

output:

5
3
4
5

result:

ok 4 lines

Test #16:

score: 0
Accepted
time: 919ms
memory: 177376kb

input:

5
21
3S 3H 9H 5H 6C 6H 2C 7D 4D 7S 7H KS 9C 8H 5S 8S 6S 2H KH TH 3C
1 0 0 1 0 0
21
QH 4S AH 8C 7C 6C 5S KS 3H AS 9H JH 5C KC JC 4C 3C 4D JS 4H 3S
0 0 1 1 1 0
21
4H AH KS 8H TS 9D QD JH 2C 2H KD QH JD 8C 4D 4S KC 9H 2D 3C 7C
1 0 0 0 1 1
21
KS AS 7C QH TD TS 2C 8D 8H 9H 4H 3H 2D QC 3D 4C 5S 6S 5H 3S 4...

output:

3
4
4
4
4

result:

ok 5 lines

Test #17:

score: 0
Accepted
time: 956ms
memory: 177444kb

input:

7
14
3D 7S 9S QS 5H 9H AC 2S TD KH 5D KS JC QC
1 0 0 0 0 0
14
8D 5D AD 2H AC TC JD TS KH JS 3D 2D 8C 9C
0 0 0 0 0 0
15
TS 8H 6S 5S 7C JS 2S 7S 8C AS 8S 5C 4H 4S TH
0 1 0 0 0 0
15
QH 3S JH QD 5S 9C 5C 7H 8D TD QC 5D 2S 5H 7S
1 1 1 0 0 1
16
JS 8C JC 8S 9H AC 3C 4D 5C 8D JH 7S 4S QH 9D 9C
1 0 0 0 0 0
1...

output:

2
1
2
3
2
2
3

result:

ok 7 lines

Test #18:

score: 0
Accepted
time: 919ms
memory: 177636kb

input:

1
36
AH 2H 3H 4H 5H 6H 7H 8H 9H AC 2C 3C 4C 5C 6C 7C 8C 9C AD 2D 3D 4D 5D 6D 7D 8D 9D AS 2S 3S 4S 5S 6S 7S 8S 9S
1 1 1 0 0 0

output:

7

result:

ok single line: '7'

Test #19:

score: 0
Accepted
time: 955ms
memory: 177608kb

input:

7
15
3C 9D 8C 6S 5S QS 8D AH 3D 5C TD QD 9S 6C 6D
1 1 1 0 0 0
16
3C 8C JS 3S AC 7D QS KC JH KS AS 2S 9H 4D 2H 5H
0 1 0 0 0 0
14
JS 9H AC 7C KH 5H 4H 2S KC TC 2D QS AD QC
0 0 0 0 1 0
14
JH KH 6H KC 9H TH 2S QS 4S 3S JS 8D 4C AH
1 0 0 0 1 0
15
5D 7S 8S 2C TH TC 5C KD 4C QH 2S 6D 3H AS KS
0 0 0 0 1 0
1...

output:

2
2
2
2
2
3
2

result:

ok 7 lines

Test #20:

score: 0
Accepted
time: 933ms
memory: 177440kb

input:

3
35
8H 8D 3H JD 4S AD KC JC 5D KH QD JH 5C QS 3C 2S 4H 3S 7D AH 8S 6C TS JS KS 6S 7C TH QH 9H 9D 8C AC 6H AS
0 0 1 0 1 0
34
KC AS KS 3S 5H JC TD 2C JS KD 4C 8C AD QS 9D 5S AC 3H 2H 3C QD 9S 6D 4S QC 8H 6C TS 7C 4D 9H 6S QH TC
0 1 0 0 1 1
35
3H 9C 2C 5S TS TC QD AS 8C 5D 4H 6C 7C 9H 6S 7H KS 2S 8D A...

output:

6
6
7

result:

ok 3 lines

Test #21:

score: 0
Accepted
time: 931ms
memory: 177416kb

input:

5
21
TH 9C 5S 9H KD JD JS 3C KH 3S 6S 7D 8S JH 4D 7H 9D 6D KC 7S 4C
1 1 0 1 0 0
20
6C QC 2D 2S 4H QS 8S KD 9H 3H 7H JD 7D KC 2C 5C 8D 7C 4S JC
1 0 0 0 1 1
21
JC 9C 8H 2D TS QH TC 6C 6S 6D 9S 4D KC 7C 4C 5C QD JS 8D AD QC
1 0 0 1 0 0
22
2C 6S 8S JC 9H 8H 4S 8C JD 4H 5S 5H QH 6H 6D 9D KC 7S 2S 3D 8D T...

output:

4
4
3
4
2

result:

ok 5 lines

Test #22:

score: 0
Accepted
time: 899ms
memory: 177436kb

input:

2
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JC JS QH QD QC QS KH KD KC KS
1 1 1 1 1 1
52
AC AH AD AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH J...

output:

10
10

result:

ok 2 lines

Test #23:

score: 0
Accepted
time: 950ms
memory: 177400kb

input:

3
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JC JS QH QD QC QS KH KD KC KS
1 1 1 1 1 1
51
AC AH AD AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD J...

output:

10
10
0

result:

ok 3 lines

Test #24:

score: 0
Accepted
time: 931ms
memory: 177380kb

input:

4
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JC JS QH QD QC QS KH KD KC KS
1 1 1 1 1 1
1
JD
1 1 1 1 1 1
50
AC AH AD AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 8D 8C 8S 9H 9D 9C 9S TH TD...

output:

10
0
10
0

result:

ok 4 lines

Test #25:

score: 0
Accepted
time: 938ms
memory: 177624kb

input:

13
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JC JS QH QD QC QS KH KD KC KS
1 1 1 1 1 1
1
JD
1 1 1 1 1 1
41
AC AD AS 2H 2C 2S 3H 3C 4H 4D 4C 5H 5D 5S 6D 6S 7H 7D 7C 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JS QH QD Q...

output:

10
0
8
0
0
0
0
0
0
0
0
0
0

result:

ok 13 lines

Test #26:

score: 0
Accepted
time: 923ms
memory: 177428kb

input:

5
52
AH AD AC AS 2H 2D 2C 2S 3H 3D 3C 3S 4H 4D 4C 4S 5H 5D 5C 5S 6H 6D 6C 6S 7H 7D 7C 7S 8H 8D 8C 8S 9H 9D 9C 9S TH TD TC TS JH JD JC JS QH QD QC QS KH KD KC KS
1 1 1 1 1 1
26
AH AD 2C 2S 3H 3D 4C 4S 5H 5D 6C 6S 7H 7D 8C 8S 9H 9D TC TS JH JD QC QS KH KS
1 1 1 1 1 1
13
7H 7D 8C 8S 9H 9D TC TS JH JD Q...

output:

10
5
2
1
1

result:

ok 5 lines

Extra Test:

score: 0
Extra Test Passed