結果

問題 No.133 カードゲーム
ユーザー rayyrayy
提出日時 2020-06-23 04:09:39
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 324 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 8,256 KB
最終ジャッジ日時 2023-09-16 19:42:09
合計ジャッジ時間 1,709 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,232 KB
testcase_01 AC 16 ms
8,168 KB
testcase_02 AC 16 ms
8,068 KB
testcase_03 AC 15 ms
8,180 KB
testcase_04 AC 15 ms
8,092 KB
testcase_05 AC 15 ms
8,224 KB
testcase_06 AC 15 ms
8,064 KB
testcase_07 AC 15 ms
8,204 KB
testcase_08 AC 15 ms
8,116 KB
testcase_09 AC 15 ms
8,232 KB
testcase_10 AC 15 ms
8,240 KB
testcase_11 AC 15 ms
8,160 KB
testcase_12 AC 15 ms
8,256 KB
testcase_13 AC 14 ms
8,112 KB
testcase_14 AC 15 ms
8,228 KB
testcase_15 AC 15 ms
8,112 KB
testcase_16 AC 15 ms
8,228 KB
testcase_17 AC 15 ms
8,056 KB
testcase_18 AC 15 ms
8,064 KB
testcase_19 AC 16 ms
8,240 KB
testcase_20 AC 15 ms
8,064 KB
testcase_21 AC 16 ms
8,176 KB
testcase_22 AC 15 ms
8,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = list(permutations(a))
m = len(p)
win = 0
for i in range(m):
    cnt = 0
    for j in range(n):
        if p[i][j] > b[j]:
            cnt += 1
    if cnt > n / 2:
        win += 1
print(win / m)
0