結果

問題 No.210 探し物はどこですか?
ユーザー mkawa2mkawa2
提出日時 2020-05-16 13:52:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,192 ms / 2,000 ms
コード長 1,184 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,080 KB
実行使用メモリ 10,384 KB
最終ジャッジ日時 2023-10-22 06:19:27
合計ジャッジ時間 47,412 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 932 ms
10,264 KB
testcase_01 AC 1,086 ms
10,300 KB
testcase_02 AC 1,169 ms
10,376 KB
testcase_03 AC 833 ms
10,260 KB
testcase_04 AC 810 ms
10,260 KB
testcase_05 AC 787 ms
10,260 KB
testcase_06 AC 797 ms
10,260 KB
testcase_07 AC 787 ms
10,260 KB
testcase_08 AC 752 ms
10,260 KB
testcase_09 AC 764 ms
10,260 KB
testcase_10 AC 763 ms
10,260 KB
testcase_11 AC 748 ms
10,260 KB
testcase_12 AC 803 ms
10,260 KB
testcase_13 AC 1,002 ms
10,264 KB
testcase_14 AC 1,170 ms
10,264 KB
testcase_15 AC 1,097 ms
10,264 KB
testcase_16 AC 1,066 ms
10,264 KB
testcase_17 AC 1,102 ms
10,264 KB
testcase_18 AC 836 ms
10,260 KB
testcase_19 AC 837 ms
10,260 KB
testcase_20 AC 840 ms
10,260 KB
testcase_21 AC 840 ms
10,260 KB
testcase_22 AC 839 ms
10,260 KB
testcase_23 AC 1,055 ms
10,312 KB
testcase_24 AC 1,047 ms
10,312 KB
testcase_25 AC 1,050 ms
10,312 KB
testcase_26 AC 1,056 ms
10,312 KB
testcase_27 AC 1,066 ms
10,308 KB
testcase_28 AC 1,071 ms
10,300 KB
testcase_29 AC 1,074 ms
10,300 KB
testcase_30 AC 1,077 ms
10,300 KB
testcase_31 AC 1,075 ms
10,300 KB
testcase_32 AC 1,071 ms
10,300 KB
testcase_33 AC 1,164 ms
10,384 KB
testcase_34 AC 1,164 ms
10,384 KB
testcase_35 AC 1,166 ms
10,384 KB
testcase_36 AC 1,175 ms
10,384 KB
testcase_37 AC 1,165 ms
10,384 KB
testcase_38 AC 1,184 ms
10,376 KB
testcase_39 AC 1,192 ms
10,376 KB
testcase_40 AC 1,187 ms
10,376 KB
testcase_41 AC 1,185 ms
10,376 KB
testcase_42 AC 1,184 ms
10,376 KB
testcase_43 AC 352 ms
10,260 KB
testcase_44 AC 776 ms
10,260 KB
testcase_45 AC 812 ms
10,260 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=1000000
    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