結果

問題 No.2009 Drunkers' Contest
ユーザー chineristACchineristAC
提出日時 2022-07-15 21:44:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 149,436 KB
最終ジャッジ日時 2023-09-10 01:12:29
合計ジャッジ時間 15,999 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
74,596 KB
testcase_01 AC 113 ms
74,656 KB
testcase_02 AC 115 ms
74,824 KB
testcase_03 AC 114 ms
74,644 KB
testcase_04 AC 113 ms
74,764 KB
testcase_05 AC 114 ms
74,908 KB
testcase_06 AC 112 ms
74,672 KB
testcase_07 AC 116 ms
74,980 KB
testcase_08 AC 114 ms
74,612 KB
testcase_09 AC 115 ms
74,504 KB
testcase_10 AC 115 ms
74,856 KB
testcase_11 AC 114 ms
74,468 KB
testcase_12 AC 117 ms
74,404 KB
testcase_13 AC 118 ms
74,676 KB
testcase_14 AC 128 ms
79,908 KB
testcase_15 AC 130 ms
79,472 KB
testcase_16 AC 129 ms
79,916 KB
testcase_17 AC 125 ms
79,672 KB
testcase_18 AC 124 ms
79,988 KB
testcase_19 AC 128 ms
79,912 KB
testcase_20 AC 128 ms
79,848 KB
testcase_21 AC 124 ms
79,840 KB
testcase_22 AC 124 ms
79,680 KB
testcase_23 AC 122 ms
80,032 KB
testcase_24 AC 259 ms
144,676 KB
testcase_25 AC 250 ms
144,676 KB
testcase_26 AC 248 ms
144,420 KB
testcase_27 AC 261 ms
144,596 KB
testcase_28 AC 284 ms
144,648 KB
testcase_29 AC 261 ms
144,640 KB
testcase_30 AC 280 ms
144,488 KB
testcase_31 AC 259 ms
144,416 KB
testcase_32 AC 281 ms
144,644 KB
testcase_33 AC 286 ms
144,660 KB
testcase_34 AC 244 ms
142,808 KB
testcase_35 AC 240 ms
143,020 KB
testcase_36 AC 230 ms
142,736 KB
testcase_37 AC 228 ms
142,904 KB
testcase_38 AC 247 ms
143,092 KB
testcase_39 AC 239 ms
142,792 KB
testcase_40 AC 244 ms
143,008 KB
testcase_41 AC 245 ms
143,100 KB
testcase_42 AC 251 ms
142,948 KB
testcase_43 AC 243 ms
143,224 KB
testcase_44 AC 229 ms
140,332 KB
testcase_45 AC 227 ms
140,384 KB
testcase_46 AC 198 ms
136,452 KB
testcase_47 AC 232 ms
149,308 KB
testcase_48 AC 231 ms
149,436 KB
testcase_49 AC 228 ms
145,016 KB
testcase_50 AC 236 ms
148,216 KB
testcase_51 AC 232 ms
145,256 KB
testcase_52 AC 227 ms
141,012 KB
testcase_53 AC 225 ms
145,960 KB
testcase_54 AC 220 ms
142,568 KB
testcase_55 AC 211 ms
140,376 KB
testcase_56 AC 209 ms
140,396 KB
testcase_57 AC 224 ms
144,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
A = li()
B = li()

stack = [(A[0],B[0])]
for i in range(1,N):
    a,b = A[i],B[i]
    while stack:
        pa,pb = stack[-1]
        if pa*b >= a*pb:
            stack.pop()
            a,b = pa+a,pb+b
        else:
            break
    stack.append((a,b))

res = 0
for a,b in stack:
    if a <= b:
        res += a + b
    else:
        res += 2 * (a*b)**.5

print(res)
0