結果

問題 No.133 カードゲーム
ユーザー kohei2019kohei2019
提出日時 2021-08-02 22:30:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 2,279 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 71,464 KB
最終ジャッジ日時 2023-10-14 20:57:52
合計ジャッジ時間 4,758 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,420 KB
testcase_01 AC 75 ms
71,252 KB
testcase_02 AC 76 ms
71,352 KB
testcase_03 AC 76 ms
71,232 KB
testcase_04 AC 75 ms
71,312 KB
testcase_05 AC 76 ms
71,212 KB
testcase_06 AC 77 ms
71,352 KB
testcase_07 AC 75 ms
71,204 KB
testcase_08 AC 77 ms
71,412 KB
testcase_09 AC 76 ms
71,328 KB
testcase_10 AC 77 ms
71,420 KB
testcase_11 AC 77 ms
71,360 KB
testcase_12 AC 77 ms
71,460 KB
testcase_13 AC 76 ms
71,188 KB
testcase_14 AC 77 ms
71,356 KB
testcase_15 AC 76 ms
71,356 KB
testcase_16 AC 77 ms
71,464 KB
testcase_17 AC 77 ms
71,404 KB
testcase_18 AC 76 ms
71,192 KB
testcase_19 AC 76 ms
71,276 KB
testcase_20 AC 77 ms
71,380 KB
testcase_21 AC 77 ms
71,264 KB
testcase_22 AC 77 ms
71,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
lsA = list(map(int,input().split()))
lsB = list(map(int,input().split()))
lspa = itertools.permutations(lsA,N)
lspb = itertools.permutations(lsB,N)

cntall = 0
cntwin = 0
for A in lspa:
    for B in lspb:
        point = 0
        for i in range(N):
            if A[i] > B[i]:
                point += 1
        if point > N//2:
            cntwin += 1
        cntall += 1
print(cntwin/cntall)
0