結果

問題 No.2009 Drunkers' Contest
ユーザー tassei903tassei903
提出日時 2022-07-16 02:27:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 299 ms / 2,000 ms
コード長 725 bytes
コンパイル時間 1,148 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 149,240 KB
最終ジャッジ日時 2023-09-10 09:12:29
合計ジャッジ時間 15,311 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,528 KB
testcase_01 AC 69 ms
71,516 KB
testcase_02 AC 69 ms
71,612 KB
testcase_03 AC 68 ms
71,180 KB
testcase_04 AC 69 ms
71,228 KB
testcase_05 AC 69 ms
71,488 KB
testcase_06 AC 69 ms
71,556 KB
testcase_07 AC 69 ms
71,436 KB
testcase_08 AC 69 ms
71,592 KB
testcase_09 AC 68 ms
71,564 KB
testcase_10 AC 69 ms
71,700 KB
testcase_11 AC 69 ms
71,776 KB
testcase_12 AC 70 ms
71,352 KB
testcase_13 AC 69 ms
71,328 KB
testcase_14 AC 97 ms
76,604 KB
testcase_15 AC 84 ms
76,996 KB
testcase_16 AC 83 ms
76,872 KB
testcase_17 AC 91 ms
76,864 KB
testcase_18 AC 91 ms
76,976 KB
testcase_19 AC 94 ms
76,956 KB
testcase_20 AC 95 ms
76,964 KB
testcase_21 AC 94 ms
76,956 KB
testcase_22 AC 91 ms
76,940 KB
testcase_23 AC 95 ms
77,544 KB
testcase_24 AC 252 ms
134,144 KB
testcase_25 AC 216 ms
133,528 KB
testcase_26 AC 229 ms
133,776 KB
testcase_27 AC 232 ms
134,012 KB
testcase_28 AC 229 ms
134,276 KB
testcase_29 AC 228 ms
133,748 KB
testcase_30 AC 226 ms
133,876 KB
testcase_31 AC 222 ms
133,580 KB
testcase_32 AC 250 ms
133,732 KB
testcase_33 AC 224 ms
133,932 KB
testcase_34 AC 204 ms
131,660 KB
testcase_35 AC 204 ms
131,956 KB
testcase_36 AC 217 ms
132,248 KB
testcase_37 AC 205 ms
132,232 KB
testcase_38 AC 204 ms
132,232 KB
testcase_39 AC 203 ms
132,120 KB
testcase_40 AC 206 ms
131,944 KB
testcase_41 AC 203 ms
131,924 KB
testcase_42 AC 204 ms
131,636 KB
testcase_43 AC 203 ms
131,824 KB
testcase_44 AC 178 ms
136,940 KB
testcase_45 AC 185 ms
135,788 KB
testcase_46 AC 200 ms
149,240 KB
testcase_47 AC 172 ms
120,460 KB
testcase_48 AC 174 ms
120,556 KB
testcase_49 AC 299 ms
113,584 KB
testcase_50 AC 199 ms
130,728 KB
testcase_51 AC 196 ms
127,440 KB
testcase_52 AC 187 ms
123,056 KB
testcase_53 AC 189 ms
136,156 KB
testcase_54 AC 181 ms
132,680 KB
testcase_55 AC 170 ms
129,224 KB
testcase_56 AC 166 ms
128,992 KB
testcase_57 AC 186 ms
137,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#####################################################################
n = ni()
a = na()
b = na()
dq = []
def f(x,y):
    return x[0] * y[1] > x[1] * y[0]

for i in range(n):
    dq.append((a[i],b[i]))
    while len(dq) > 1 and f(dq[-2],dq[-1]):
        x = dq.pop()
        y = dq.pop()
        dq.append((x[0]+y[0],x[1]+y[1]))

ans = 0
for i in dq:
    x = max(i[0]/i[1],1)**0.5
    #print(i[0],i[1])
    ans += i[0] / x + i[1] * x
print(ans)
0