結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-01 01:31:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 5,000 ms |
| コード長 | 358 bytes |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 82,256 KB |
| 実行使用メモリ | 61,372 KB |
| 最終ジャッジ日時 | 2024-11-19 15:20:26 |
| 合計ジャッジ時間 | 2,252 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
import itertools as it
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for pa in it.permutations(a, n):
for pb in it.permutations(b, n):
cnt = 0
for i in range(n):
if pa[i] > pb[i]:
cnt += 1
if cnt > n // 2:
ans += 1
ans /= (math.factorial(n) ** 2)
print(ans)