結果

問題 No.210 探し物はどこですか?
ユーザー rpy3cpprpy3cpp
提出日時 2015-05-18 01:00:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 82,352 KB
最終ジャッジ日時 2023-09-20 09:41:10
合計ジャッジ時間 48,471 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 994 ms
81,892 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

def read_data():
    n = int(input())
    ps = list(map(int, input().split()))
    qs = list(map(int, input().split()))
    return n, ps, qs

def solve(n, ps, qs):
    ps, qs = drop_zero_prob(ps, qs)
    ps = [p / 1000.0 for p in ps]
    qs = [q / 100.0 for q in qs]
    return f(ps, qs)

def drop_zero_prob(ps, qs):
    return zip(*[(p, q) for p, q in zip(ps, qs) if p > 0])
    

def f(ps, qs):
    pqs = [(- p * q, p, 1 - q) for p, q in zip(ps, qs)]
    pqs.sort()
    c = coef = sum_p = 1
    eps = 1.0 * 10**(-5)
    while coef > eps:
        mpq0, p0, qq0 = pqs[0]
        coef *= 1 + mpq0/sum_p
        c += coef
        sum_p += mpq0
        heapq.heapreplace(pqs, (mpq0*qq0, p0*qq0, qq0))
    return c
    

if __name__ == '__main__':
#    n, ps, qs = read_data()
    n = 1000
    ps = [1] * n
    qs = [1] * n
    print(solve(n, ps, qs))
0