結果

問題 No.2009 Drunkers' Contest
ユーザー 👑 KazunKazun
提出日時 2022-07-15 23:59:09
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 345 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 147,024 KB
最終ジャッジ日時 2023-09-10 06:14:14
合計ジャッジ時間 14,569 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,596 KB
testcase_01 AC 73 ms
71,476 KB
testcase_02 AC 74 ms
71,136 KB
testcase_03 AC 73 ms
71,316 KB
testcase_04 AC 75 ms
71,032 KB
testcase_05 AC 74 ms
71,204 KB
testcase_06 AC 72 ms
71,136 KB
testcase_07 AC 76 ms
71,344 KB
testcase_08 AC 75 ms
71,476 KB
testcase_09 AC 74 ms
71,708 KB
testcase_10 AC 74 ms
71,732 KB
testcase_11 AC 73 ms
71,404 KB
testcase_12 AC 72 ms
71,252 KB
testcase_13 AC 73 ms
71,252 KB
testcase_14 AC 85 ms
76,792 KB
testcase_15 AC 84 ms
76,688 KB
testcase_16 AC 84 ms
76,856 KB
testcase_17 AC 93 ms
77,040 KB
testcase_18 AC 85 ms
76,908 KB
testcase_19 AC 94 ms
77,032 KB
testcase_20 AC 86 ms
76,868 KB
testcase_21 AC 93 ms
76,868 KB
testcase_22 AC 90 ms
76,808 KB
testcase_23 AC 93 ms
76,960 KB
testcase_24 AC 183 ms
133,284 KB
testcase_25 AC 187 ms
133,628 KB
testcase_26 AC 183 ms
133,444 KB
testcase_27 AC 186 ms
133,776 KB
testcase_28 AC 181 ms
133,520 KB
testcase_29 AC 194 ms
133,560 KB
testcase_30 AC 196 ms
133,392 KB
testcase_31 AC 189 ms
133,464 KB
testcase_32 AC 190 ms
133,676 KB
testcase_33 AC 185 ms
133,428 KB
testcase_34 AC 177 ms
131,444 KB
testcase_35 AC 176 ms
131,796 KB
testcase_36 AC 194 ms
131,752 KB
testcase_37 AC 181 ms
131,892 KB
testcase_38 AC 178 ms
131,444 KB
testcase_39 AC 181 ms
131,836 KB
testcase_40 AC 187 ms
131,836 KB
testcase_41 AC 183 ms
131,812 KB
testcase_42 AC 180 ms
131,528 KB
testcase_43 AC 184 ms
131,940 KB
testcase_44 AC 177 ms
135,888 KB
testcase_45 AC 173 ms
133,680 KB
testcase_46 AC 177 ms
147,024 KB
testcase_47 AC 157 ms
120,392 KB
testcase_48 AC 157 ms
120,304 KB
testcase_49 RE -
testcase_50 AC 452 ms
130,864 KB
testcase_51 AC 166 ms
117,592 KB
testcase_52 AC 163 ms
114,164 KB
testcase_53 AC 178 ms
137,500 KB
testcase_54 AC 173 ms
133,056 KB
testcase_55 AC 172 ms
128,900 KB
testcase_56 AC 167 ms
128,888 KB
testcase_57 AC 179 ms
138,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

S=[]
for i in range(N):
    a=A[i]; b=B[i]
    while bool(S) and S[-1][0]/S[-1][1]>a/b:
        Sa,Sb=S.pop()
        a+=Sa; b+=Sb
    S.append((a,b))

T=0
for a,b in S:
    if a>b:
        T+=2*sqrt(a*b)
    else:
        T+=a+b

print(T)
0