結果

問題 No.210 探し物はどこですか?
ユーザー mkawa2mkawa2
提出日時 2020-01-28 12:43:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,805 ms / 2,000 ms
コード長 1,184 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 84,700 KB
最終ジャッジ日時 2023-10-13 16:39:19
合計ジャッジ時間 67,284 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 984 ms
78,628 KB
testcase_01 AC 1,140 ms
80,492 KB
testcase_02 AC 1,231 ms
83,828 KB
testcase_03 AC 1,224 ms
77,804 KB
testcase_04 AC 1,203 ms
77,420 KB
testcase_05 AC 1,189 ms
77,880 KB
testcase_06 AC 1,208 ms
78,004 KB
testcase_07 AC 1,252 ms
78,632 KB
testcase_08 AC 1,208 ms
78,672 KB
testcase_09 AC 1,326 ms
78,080 KB
testcase_10 AC 1,268 ms
78,788 KB
testcase_11 AC 1,158 ms
78,008 KB
testcase_12 AC 1,243 ms
78,396 KB
testcase_13 AC 1,462 ms
78,616 KB
testcase_14 AC 1,778 ms
78,112 KB
testcase_15 AC 1,655 ms
79,048 KB
testcase_16 AC 1,536 ms
78,236 KB
testcase_17 AC 1,426 ms
78,240 KB
testcase_18 AC 1,064 ms
78,724 KB
testcase_19 AC 1,066 ms
79,100 KB
testcase_20 AC 1,051 ms
79,192 KB
testcase_21 AC 1,042 ms
78,852 KB
testcase_22 AC 1,053 ms
79,236 KB
testcase_23 AC 1,557 ms
80,100 KB
testcase_24 AC 1,584 ms
79,956 KB
testcase_25 AC 1,694 ms
80,100 KB
testcase_26 AC 1,599 ms
79,852 KB
testcase_27 AC 1,661 ms
81,104 KB
testcase_28 AC 1,435 ms
80,708 KB
testcase_29 AC 1,462 ms
80,812 KB
testcase_30 AC 1,447 ms
80,984 KB
testcase_31 AC 1,448 ms
80,592 KB
testcase_32 AC 1,426 ms
80,692 KB
testcase_33 AC 1,780 ms
84,700 KB
testcase_34 AC 1,690 ms
83,588 KB
testcase_35 AC 1,805 ms
84,244 KB
testcase_36 AC 1,666 ms
84,496 KB
testcase_37 AC 1,703 ms
83,504 KB
testcase_38 AC 1,630 ms
83,640 KB
testcase_39 AC 1,713 ms
83,784 KB
testcase_40 AC 1,612 ms
83,424 KB
testcase_41 AC 1,629 ms
83,312 KB
testcase_42 AC 1,649 ms
83,088 KB
testcase_43 AC 114 ms
76,952 KB
testcase_44 AC 894 ms
77,452 KB
testcase_45 AC 1,297 ms
77,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

from heapq import *
def main():
    # 期待値の基本通り、確率×回数の和を求めていく
    # 「次にどの部屋を探せばよいか」を最適化する
    # もちろん「最も見つかる確率の高い部屋」がよい
    # ある部屋でk回目に見つかる確率はp*(1-q)^(k-1)*q
    # 各部屋の確率をheapqにいれて、確率の高い部屋を順次探していく
    # 探すたびに確率×回数を答えに足していく
    # 十分な回数を行えば収束する
    n=II()
    pp=LI()
    qq=LI()
    hp=[]
    ans=0
    for i,(p,q) in enumerate(zip(pp,qq)):
        heappush(hp,(-p*q/100000,i))
    loop=3000000
    for cnt in range(1,loop):
        pq,i=heappop(hp)
        ans+=-pq*cnt
        heappush(hp,(pq*(1-qq[i]/100),i))
    print(ans)

main()
0