結果

問題 No.2009 Drunkers' Contest
ユーザー mkawa2mkawa2
提出日時 2022-07-16 09:56:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 1,049 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 139,468 KB
最終ジャッジ日時 2023-09-10 17:19:08
合計ジャッジ時間 15,764 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,740 KB
testcase_01 AC 71 ms
71,544 KB
testcase_02 AC 70 ms
71,552 KB
testcase_03 AC 70 ms
71,324 KB
testcase_04 AC 71 ms
71,888 KB
testcase_05 AC 70 ms
71,324 KB
testcase_06 AC 71 ms
71,448 KB
testcase_07 AC 71 ms
71,708 KB
testcase_08 AC 70 ms
71,816 KB
testcase_09 AC 70 ms
71,856 KB
testcase_10 AC 71 ms
71,452 KB
testcase_11 AC 70 ms
71,448 KB
testcase_12 AC 71 ms
71,728 KB
testcase_13 AC 71 ms
71,860 KB
testcase_14 AC 84 ms
77,268 KB
testcase_15 AC 88 ms
77,128 KB
testcase_16 AC 86 ms
77,268 KB
testcase_17 AC 86 ms
77,152 KB
testcase_18 AC 87 ms
77,112 KB
testcase_19 AC 87 ms
77,364 KB
testcase_20 AC 87 ms
77,272 KB
testcase_21 AC 87 ms
77,096 KB
testcase_22 AC 90 ms
77,308 KB
testcase_23 AC 87 ms
77,480 KB
testcase_24 AC 228 ms
135,352 KB
testcase_25 AC 216 ms
135,256 KB
testcase_26 AC 211 ms
134,836 KB
testcase_27 AC 217 ms
135,024 KB
testcase_28 AC 216 ms
135,168 KB
testcase_29 AC 226 ms
135,484 KB
testcase_30 AC 210 ms
135,080 KB
testcase_31 AC 218 ms
135,124 KB
testcase_32 AC 214 ms
134,904 KB
testcase_33 AC 221 ms
135,160 KB
testcase_34 AC 217 ms
133,784 KB
testcase_35 AC 224 ms
134,092 KB
testcase_36 AC 218 ms
133,588 KB
testcase_37 AC 211 ms
133,712 KB
testcase_38 AC 216 ms
133,660 KB
testcase_39 AC 218 ms
133,876 KB
testcase_40 AC 215 ms
133,784 KB
testcase_41 AC 212 ms
133,496 KB
testcase_42 AC 211 ms
133,684 KB
testcase_43 AC 212 ms
133,624 KB
testcase_44 AC 167 ms
136,552 KB
testcase_45 AC 167 ms
136,472 KB
testcase_46 AC 187 ms
133,724 KB
testcase_47 AC 178 ms
132,476 KB
testcase_48 AC 186 ms
138,616 KB
testcase_49 AC 187 ms
132,368 KB
testcase_50 AC 189 ms
132,780 KB
testcase_51 AC 199 ms
136,368 KB
testcase_52 AC 201 ms
135,916 KB
testcase_53 AC 193 ms
136,032 KB
testcase_54 AC 200 ms
133,532 KB
testcase_55 AC 196 ms
131,944 KB
testcase_56 AC 196 ms
132,236 KB
testcase_57 AC 195 ms
139,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

n = II()
aa = LI()
bb = LI()

st = []
for a, b in zip(aa[::-1], bb[::-1]):
    cur = max(0, (a/b)**0.5-1)
    while st and cur >= st[-1][-1]:
        pa, pb, pc = st.pop()
        a, b = a+pa, b+pb
        cur = max(0, (a/b)**0.5-1)
    st.append((a, b, cur))

ans = 0
for a, b, c in st:
    ans += a/(1+c)+b*(1+c)

print(ans)
0