結果

問題 No.210 探し物はどこですか?
ユーザー mkawa2mkawa2
提出日時 2020-05-16 13:51:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,183 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 78,016 KB
最終ジャッジ日時 2023-10-22 06:17:32
合計ジャッジ時間 14,075 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 191 ms
76,552 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 212 ms
76,636 KB
testcase_04 AC 192 ms
76,116 KB
testcase_05 AC 194 ms
76,340 KB
testcase_06 AC 201 ms
76,340 KB
testcase_07 AC 196 ms
76,340 KB
testcase_08 AC 144 ms
76,468 KB
testcase_09 AC 183 ms
76,484 KB
testcase_10 AC 149 ms
76,500 KB
testcase_11 AC 143 ms
76,308 KB
testcase_12 AC 152 ms
76,392 KB
testcase_13 AC 196 ms
76,596 KB
testcase_14 AC 228 ms
76,792 KB
testcase_15 AC 241 ms
76,788 KB
testcase_16 AC 221 ms
76,540 KB
testcase_17 AC 237 ms
76,628 KB
testcase_18 AC 232 ms
77,116 KB
testcase_19 AC 226 ms
76,820 KB
testcase_20 AC 229 ms
76,900 KB
testcase_21 AC 228 ms
76,824 KB
testcase_22 AC 229 ms
76,780 KB
testcase_23 AC 283 ms
77,208 KB
testcase_24 AC 274 ms
77,200 KB
testcase_25 AC 288 ms
77,516 KB
testcase_26 AC 280 ms
77,512 KB
testcase_27 AC 285 ms
77,652 KB
testcase_28 AC 278 ms
77,120 KB
testcase_29 AC 272 ms
76,976 KB
testcase_30 AC 274 ms
76,844 KB
testcase_31 AC 263 ms
77,180 KB
testcase_32 AC 264 ms
77,332 KB
testcase_33 AC 318 ms
77,948 KB
testcase_34 AC 306 ms
77,916 KB
testcase_35 AC 310 ms
77,756 KB
testcase_36 AC 300 ms
77,868 KB
testcase_37 AC 304 ms
78,016 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 51 ms
72,508 KB
testcase_44 AC 149 ms
75,720 KB
testcase_45 AC 211 ms
76,388 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=300000
    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