結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2022-06-21 11:58:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-14 05:19:16 |
合計ジャッジ時間 | 1,728 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
from itertools import permutationsfrom math import factorialn=int(input())a=list(map(int,input().split()))b=list(map(int,input().split()))deno=0for per_a in permutations(range(n)):tmp_a=[]for i in range(n):tmp_a.append(a[per_a[i]])for per_b in permutations(range(n)):tmp_b=[]cnt=0for i in range(n):tmp_b.append(b[per_b[i]])for i in range(n):if tmp_a[i]>tmp_b[i]:cnt+=1if (n==1 and cnt==1) or (n==2 and cnt==2) or (n==3 and cnt>=2) or (n==4 and cnt>=3):deno+=1print(deno/factorial(n)**2)