結果

問題 No.133 カードゲーム
ユーザー ronpooronpoo
提出日時 2023-08-22 17:29:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 469 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 86,316 KB
実行使用メモリ 76,308 KB
最終ジャッジ日時 2023-08-22 17:30:02
合計ジャッジ時間 3,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,744 KB
testcase_01 AC 72 ms
71,048 KB
testcase_02 AC 72 ms
70,952 KB
testcase_03 AC 73 ms
71,008 KB
testcase_04 AC 74 ms
71,028 KB
testcase_05 AC 80 ms
75,968 KB
testcase_06 AC 81 ms
76,052 KB
testcase_07 AC 81 ms
75,976 KB
testcase_08 AC 74 ms
70,884 KB
testcase_09 AC 75 ms
70,748 KB
testcase_10 AC 80 ms
75,920 KB
testcase_11 AC 79 ms
76,136 KB
testcase_12 AC 80 ms
76,256 KB
testcase_13 AC 72 ms
71,168 KB
testcase_14 AC 71 ms
71,028 KB
testcase_15 AC 72 ms
71,240 KB
testcase_16 AC 80 ms
75,888 KB
testcase_17 AC 79 ms
76,280 KB
testcase_18 AC 83 ms
76,120 KB
testcase_19 AC 80 ms
76,308 KB
testcase_20 AC 82 ms
75,752 KB
testcase_21 AC 81 ms
75,776 KB
testcase_22 AC 82 ms
75,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

win = 0
cnt = 0
for pa in permutations(range(N)):
    for pb in permutations(range(N)):
        cnt += 1
        aw = 0
        bw = 0
        for a, b in zip(pa, pb):
            if A[a] > B[b]:
                aw += 1
            elif A[a] < B[b]:
                bw += 1
        if aw > bw:
            win += 1

ans = win / cnt
print(ans)
0