結果

問題 No.173 カードゲーム(Medium)
ユーザー yaoshimax
提出日時 2015-03-27 00:42:12
言語 PyPy2
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 772 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 76,928 KB
実行使用メモリ 95,232 KB
最終ジャッジ日時 2024-06-29 01:19:31
合計ジャッジ時間 21,617 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import random

N,Pa,Pb=map(float,raw_input().split())
N=int(N)
As=map(int,raw_input().split())
Bs=map(int,raw_input().split())
As.sort()
Bs.sort()
n_win=0
for i in range(1000000):
    A=[a for a in As]
    B=[b for b in Bs]
    Ascore=0
    Bscore=0
    for j in range(N):
        a=A[0]
        b=B[0]
        if len(A)==1 or random.random()<=Pa:
            del A[0]
        else:
            ai=random.randint(1,len(A)-1)
            a=A[ai]
            del A[ai]
        if len(B)==1 or random.random()<=Pb:
            del B[0]
        else:
            bi=random.randint(1,len(B)-1)
            b=B[bi]
            del B[bi]
        if a>b:
            Ascore+=a+b
        else:
            Bscore+=a+b
    if Ascore>Bscore:
        n_win+=1
print n_win*1.0/1000000
0