結果

問題 No.173 カードゲーム(Medium)
ユーザー convexineqconvexineq
提出日時 2020-12-15 19:57:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,322 ms / 3,000 ms
コード長 745 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 81,704 KB
実行使用メモリ 80,520 KB
最終ジャッジ日時 2023-10-20 06:27:39
合計ジャッジ時間 8,286 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
76,652 KB
testcase_01 AC 407 ms
79,228 KB
testcase_02 AC 1,053 ms
79,832 KB
testcase_03 AC 1,055 ms
79,584 KB
testcase_04 AC 1,033 ms
79,900 KB
testcase_05 AC 748 ms
78,164 KB
testcase_06 AC 638 ms
77,952 KB
testcase_07 AC 543 ms
77,720 KB
testcase_08 AC 518 ms
77,624 KB
testcase_09 AC 1,322 ms
80,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,pa,pb = input().split()
n = int(n)
pa,pb = int(round(float(pa)*1000)), int(round(float(pb)*1000))
*a, = map(int,input().split())
*b, = map(int,input().split())
a.sort()
b.sort()

from random import randrange
def check():
    d = 0
    aa = a[:]
    bb = b[:]
    for i in range(n):
        r = randrange(0,1000)
        if i == n-1 or r < pa:
            ca = aa.pop(0)
        else:
            r = randrange(1,n-i)
            ca = aa.pop(r)
        r = randrange(0,1000)
        if i == n-1 or r < pb:
            cb = bb.pop(0)
        else:
            r = randrange(1,n-i)
            cb = bb.pop(r)
        if ca > cb: d += ca+cb
        else: d -= ca+cb
    return d > 0

T = 200000
v = 0
for _ in range(T):
    v += check()
print(v/T)
0