結果

問題 No.133 カードゲーム
コンテスト
ユーザー itaitai
提出日時 2019-09-26 11:11:20
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 96 ms / 5,000 ms
コード長 494 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 348 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2026-04-11 12:33:47
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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