結果

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

ソースコード

diff #

import random
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


trials = 1_000_000
win = 0
for _ in range(trials):
    a = A[:]
    b = B[:]
    random.shuffle(a)
    random.shuffle(b)

    if judge(a, b):
        win += 1

ans = win / trials
print(ans)
0