結果
問題 |
No.133 カードゲーム
|
ユーザー |
![]() |
提出日時 | 2019-08-15 16:54:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 551 bytes |
コンパイル時間 | 148 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-19 15:22:03 |
合計ジャッジ時間 | 1,452 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import itertools n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) game_count = 0 game_A = 0 for cards_a in list(itertools.permutations(A, n)): for cards_b in list(itertools.permutations(B, n)): win_a = 0 win_b = 0 for card_a, card_b in zip(cards_a, cards_b): if card_a > card_b: win_a += 1 elif card_b > card_a: win_b += 1 game_count += 1 if win_a > win_b: game_A += 1 print(game_A/game_count)