結果

問題 No.173 カードゲーム(Medium)
ユーザー convexineqconvexineq
提出日時 2020-12-15 19:56:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 746 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 84,952 KB
最終ジャッジ日時 2023-10-20 06:27:21
合計ジャッジ時間 13,976 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 281 ms
81,060 KB
testcase_01 AC 918 ms
79,788 KB
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 2,807 ms
78,932 KB
testcase_06 AC 2,306 ms
78,596 KB
testcase_07 AC 1,979 ms
78,228 KB
testcase_08 AC 1,916 ms
78,100 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

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 = 1000000
v = 0
for _ in range(T):
    v += check()
print(v/T)
0