結果

問題 No.200 カードファイト!
コンテスト
ユーザー titia
提出日時 2025-12-31 05:30:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,090 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 325 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 59,828 KB
最終ジャッジ日時 2025-12-31 05:30:28
合計ジャッジ時間 2,977 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

N=int(input())
x=int(input())
A0=list(map(int,input().split()))
y=int(input())
B0=list(map(int,input().split()))

A0.sort(reverse=True)
B0.sort()

A=A0[:]
while len(A)<N:
    A+=A
A=A[:N]
B=B0[:]
ANS=0



while A:
    if len(A)>=len(B):
        AX=A[:len(B)]
        A=A[len(B):]
    else:
        AX=A[:]
        A=[]

    B=B0[:]



    for i in range(len(AX)):
        a=AX[i]
        ind=-1
        
        for j in range(len(B)):
            if B[j]<a:
                ind=j

        if ind!=-1:
            B.pop(ind)
            ANS+=1
        else:
            B.pop()           

B=B0[:]
B.sort()
while len(B)<N:
    B+=B
B=B[:N]
A=A0[:]
ANS2=0
while B:
    if len(B)>=len(A):
        BX=B[:len(A)]
        B=B[len(A):]
    else:
        BX=B[:]
        B=[]

    A=A0[:]

    for i in range(len(BX)):
        b=BX[i]
        ind=-1
        
        for j in range(len(A)):
            if A[j]>b:
                ind=j

        if ind!=-1:
            A.pop(ind)
            ANS2+=1
        else:
            A.pop() 

print(max(ANS,ANS2))

0