結果

問題 No.200 カードファイト!
ユーザー qwewe
提出日時 2025-05-14 12:55:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 54,072 KB
最終ジャッジ日時 2025-05-14 12:56:07
合計ジャッジ時間 2,334 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = int(input())
b = list(map(int, input().split()))
c = int(input())
d = list(map(int, input().split()))

# Sort A's cards in descending order
a_sorted = sorted(b, reverse=True)

# Sort C's cards in descending order and move the maximum to the end
if not d:
    c_sorted = []
else:
    c_sorted = sorted(d, reverse=True)
    max_c = c_sorted[0]
    c_sorted.remove(max_c)
    c_sorted.append(max_c)

a_len = len(a_sorted)
c_len = len(c_sorted)

count = 0
for k in range(n):
    i = k % a_len
    j = k % c_len
    if a_sorted[i] > c_sorted[j]:
        count += 1

print(count)
0