結果

問題 No.200 カードファイト!
ユーザー lam6er
提出日時 2025-04-15 22:39:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 54,488 KB
最終ジャッジ日時 2025-04-15 22:40:25
合計ジャッジ時間 2,355 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

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

b.sort()
d.sort()

# Calculate the number of wins per full cycle of C's cards
wins_per_cycle = 0
for num in d:
    idx = bisect.bisect_right(b, num)
    if idx < len(b):
        wins_per_cycle += 1

# Calculate the number of full cycles and remaining matches
full_cycles = n // len(d)
remaining_matches = n % len(d)

# Calculate wins from remaining matches
remaining_wins = 0
for i in range(remaining_matches):
    num = d[i]
    idx = bisect.bisect_right(b, num)
    if idx < len(b):
        remaining_wins += 1

total_wins = full_cycles * wins_per_cycle + remaining_wins
print(total_wins)
0