結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2023-12-26 22:40:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 5,000 ms |
| コード長 | 481 bytes |
| コンパイル時間 | 316 ms |
| コンパイル使用メモリ | 82,440 KB |
| 実行使用メモリ | 62,352 KB |
| 最終ジャッジ日時 | 2024-09-27 15:17:48 |
| 合計ジャッジ時間 | 2,033 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
from itertools import permutations
from math import factorial
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if N == 1:
if A[0] > B[0]:
print(1)
else:
print(0)
exit()
win = 0
for a in permutations(A, N):
for b in permutations(B, N):
cnt = 0
for i in range(N):
if a[i] > b[i]:
cnt += 1
if cnt > N // 2:
win += 1
print(win / (factorial(N)**2))
ntuda