結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:08:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,360 KB |
実行使用メモリ | 61,700 KB |
最終ジャッジ日時 | 2025-03-20 21:08:54 |
合計ジャッジ時間 | 1,882 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import itertools n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) a_perms = list(itertools.permutations(a)) b_perms = list(itertools.permutations(b)) count = 0 total = len(a_perms) * len(b_perms) for a_p in a_perms: for b_p in b_perms: a_win = 0 for i in range(n): if a_p[i] > b_p[i]: a_win += 1 if a_win > n // 2: count += 1 probability = count / total print("{0:.6f}".format(probability))