結果
問題 |
No.133 カードゲーム
|
ユーザー |
![]() |
提出日時 | 2021-07-22 23:43:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-17 21:02:22 |
合計ジャッジ時間 | 2,183 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import itertools import math n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) win_A = 0 for order_A in itertools.permutations(A): for order_B in itertools.permutations(B): point_A = 0 point_B = 0 for i in range(n): if order_A[i] > order_B[i]: point_A += 1 else: point_B += 1 if point_A > point_B: win_A += 1 num_mathces = math.factorial(n) ** 2 print(win_A / num_mathces)