結果

問題 No.133 カードゲーム
ユーザー norioc
提出日時 2025-02-05 05:55:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 5,000 ms
コード長 451 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 59,136 KB
最終ジャッジ日時 2025-02-05 05:55:07
合計ジャッジ時間 4,063 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

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


def judge(xs, ys):
    win = 0
    for x, y in zip(xs, ys):
        if x > y:
            win += 1
        else:
            win -= 1

    return win > 0


games = 0
win = 0
for a in permutations(A):
    for b in permutations(B):
        games += 1
        if judge(a, b):
            win += 1

ans = win / games
print(ans)
0