結果

問題 No.210 探し物はどこですか?
ユーザー mkawa2mkawa2
提出日時 2020-01-28 12:32:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,182 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 8,144 KB
最終ジャッジ日時 2023-10-13 16:12:33
合計ジャッジ時間 3,604 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 21 ms
8,008 KB
testcase_04 AC 22 ms
8,020 KB
testcase_05 AC 22 ms
8,008 KB
testcase_06 AC 22 ms
8,088 KB
testcase_07 AC 21 ms
7,980 KB
testcase_08 AC 22 ms
8,020 KB
testcase_09 AC 21 ms
8,024 KB
testcase_10 AC 22 ms
8,028 KB
testcase_11 AC 22 ms
8,000 KB
testcase_12 AC 22 ms
8,028 KB
testcase_13 AC 24 ms
8,020 KB
testcase_14 AC 24 ms
8,004 KB
testcase_15 AC 23 ms
7,976 KB
testcase_16 AC 23 ms
8,008 KB
testcase_17 AC 24 ms
8,004 KB
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 AC 19 ms
8,008 KB
testcase_44 AC 22 ms
8,032 KB
testcase_45 AC 21 ms
8,020 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=10000
    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