結果
問題 | No.200 カードファイト! |
ユーザー |
![]() |
提出日時 | 2025-03-26 15:52:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,092 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,676 KB |
実行使用メモリ | 60,104 KB |
最終ジャッジ日時 | 2025-03-26 15:53:12 |
合計ジャッジ時間 | 2,297 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 21 |
ソースコード
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 orderb_sorted = sorted(b, reverse=True)# Sort C's cards in ascending orderd_sorted = sorted(d)# Calculate initial wins in the first 'a' matchesinitial_wins = 0used = [False] * len(d_sorted)for card in b_sorted:for i in range(len(d_sorted)):if not used[i] and d_sorted[i] < card:initial_wins += 1used[i] = Truebreak# Collect remaining cards for Cd_remaining = [d_sorted[i] for i in range(len(d_sorted)) if not used[i]]# Calculate wins in remaining matchesif a >= n:print(initial_wins)else:rem = n - aif not d_remaining:print(initial_wins)exit()b_max = b_sorted[0]k = sum(1 for x in d_remaining if x < b_max)m = len(d_remaining)cycles = rem // mremainder = rem % mrem_wins = cycles * krem_wins += sum(1 for x in d_remaining[:remainder] if x < b_max)total = initial_wins + rem_winsprint(total)