結果
問題 |
No.210 探し物はどこですか?
|
ユーザー |
![]() |
提出日時 | 2015-04-07 19:48:39 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 879 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-07-04 10:50:35 |
合計ジャッジ時間 | 7,195 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | WA * 1 TLE * 2 -- * 40 |
ソースコード
from Queue import * # Queue, LifoQueue, PriorityQueue from bisect import * #bisect, insort from collections import * #deque, Counter,OrderedDict,defaultdict #set([]) import math import copy import itertools import string import sys myread = lambda : map(float,raw_input().split()) def solver(): N = int(raw_input()) P = myread() Q = myread() for i in xrange(N): P[i] /= 1000 Q[i] /= 100 que = PriorityQueue(N) for i in xrange(N): que.put((P[i]*Q[i],i)) times = 1 ans = 0.0 e = 0.1 ** 8 while not(que.empty()): t = que.get() p = t[0] now = t[1] if times >= 1000000: break ans += p * times times += 1 if p * (1- Q[now]) > e: que.put((p*(1-Q[now]),now)) print "%.8f" % ans if __name__ == "__main__": solver()