結果

問題 No.133 カードゲーム
ユーザー itaitai
提出日時 2019-09-26 11:11:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 494 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-23 07:45:53
合計ジャッジ時間 1,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import itertools
n = int(input())
a = list(itertools.permutations(list(map(int,input().split()))))
b = list(itertools.permutations(list(map(int,input().split()))))
won = 0
lost = 0
for i in range(math.factorial(n)):
    for j in range(math.factorial(n)):
        win = 0
        lose = 0
        for x in zip(a[i],b[j]):
            if x[0] > x[1]:win +=1
            if x[0] <= x[1]:lose += 1
        if win > lose:
            won += 1
        else:lost += 1
print(won/(won+lost))
0