結果

問題 No.133 カードゲーム
ユーザー raven7959raven7959
提出日時 2021-09-10 17:26:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 322 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 71,656 KB
最終ジャッジ日時 2023-09-02 09:24:52
合計ジャッジ時間 3,659 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,584 KB
testcase_01 AC 68 ms
71,404 KB
testcase_02 AC 71 ms
71,344 KB
testcase_03 AC 71 ms
71,516 KB
testcase_04 AC 74 ms
71,496 KB
testcase_05 AC 69 ms
71,508 KB
testcase_06 AC 69 ms
71,608 KB
testcase_07 AC 69 ms
71,532 KB
testcase_08 AC 70 ms
71,492 KB
testcase_09 AC 69 ms
71,252 KB
testcase_10 AC 69 ms
71,632 KB
testcase_11 AC 71 ms
71,572 KB
testcase_12 AC 71 ms
71,552 KB
testcase_13 AC 71 ms
71,472 KB
testcase_14 AC 71 ms
71,456 KB
testcase_15 AC 69 ms
71,456 KB
testcase_16 AC 69 ms
71,280 KB
testcase_17 AC 70 ms
71,656 KB
testcase_18 AC 70 ms
71,164 KB
testcase_19 AC 71 ms
71,256 KB
testcase_20 AC 70 ms
71,564 KB
testcase_21 AC 68 ms
71,376 KB
testcase_22 AC 71 ms
71,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=0
for perm in permutations(range(N)):
  res=0
  for i in range(N):
    if A[perm[i]]>B[i]:
      res+=1
    else:
      res-=1
  if res>0:
    cnt+=1
fac=1
for i in range(1,N+1):
  fac*=i
print(cnt/fac)
0