結果

問題 No.133 カードゲーム
コンテスト
ユーザー はむ吉🐹
提出日時 2018-03-25 18:47:37
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 275 ms / 5,000 ms
コード長 699 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 481 ms
コンパイル使用メモリ 20,952 KB
実行使用メモリ 16,196 KB
最終ジャッジ日時 2026-03-11 11:32:32
合計ジャッジ時間 7,371 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import random
import statistics

EXP_TIMES = 50000


def judge(pair):
    if pair[0] > pair[1]:
        return 1
    else:
        return 0


def conduct_experiment(n, acs, bcs):
    random.shuffle(acs)
    random.shuffle(bcs)
    w = sum(map(judge, zip(acs, bcs)))
    if w > n - w:
        return 1.0
    else:
        return 0.0


def main(times=EXP_TIMES):
    n = int(input())
    acs = list(map(int, input().split()))
    bcs = list(map(int, input().split()))
    ans = statistics.mean(conduct_experiment(n, acs, bcs)
                          for x in range(times))
    print("{ans:.5f}".format(ans=ans))

if __name__ == "__main__":
    main()
0