結果

問題 No.133 カードゲーム
ユーザー asumo0729asumo0729
提出日時 2021-04-23 00:32:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 555 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 76,788 KB
最終ジャッジ日時 2023-09-17 10:25:30
合計ジャッジ時間 3,135 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,572 KB
testcase_01 AC 75 ms
71,588 KB
testcase_02 AC 74 ms
71,288 KB
testcase_03 AC 74 ms
71,572 KB
testcase_04 AC 74 ms
71,496 KB
testcase_05 AC 79 ms
76,524 KB
testcase_06 AC 80 ms
76,448 KB
testcase_07 AC 80 ms
76,464 KB
testcase_08 AC 72 ms
71,332 KB
testcase_09 AC 74 ms
71,652 KB
testcase_10 AC 78 ms
76,476 KB
testcase_11 AC 79 ms
76,788 KB
testcase_12 AC 81 ms
76,568 KB
testcase_13 AC 75 ms
71,496 KB
testcase_14 AC 73 ms
71,440 KB
testcase_15 AC 75 ms
71,224 KB
testcase_16 AC 82 ms
76,620 KB
testcase_17 AC 80 ms
76,300 KB
testcase_18 AC 81 ms
76,536 KB
testcase_19 AC 81 ms
76,536 KB
testcase_20 AC 80 ms
76,752 KB
testcase_21 AC 81 ms
76,604 KB
testcase_22 AC 80 ms
76,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import itertools
stdin=sys.stdin

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')

N = ip()
A = lp()
B = lp()

P = list(itertools.permutations(A,N))
Q = list(itertools.permutations(B,N))

All = len(P) * len(Q)
win = 0

for a in P:
    for b in Q:
        res = 0
        for turn in range(N):
            if a[turn] > b[turn]:
                res += 1
        if res > N - res:
            win += 1

print(win / All)
0