結果

問題 No.2009 Drunkers' Contest
ユーザー siganaisiganai
提出日時 2022-07-15 22:04:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,303 bytes
コンパイル時間 1,329 ms
コンパイル使用メモリ 87,392 KB
実行使用メモリ 213,144 KB
最終ジャッジ日時 2023-09-10 01:58:10
合計ジャッジ時間 22,229 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
213,144 KB
testcase_01 AC 147 ms
79,304 KB
testcase_02 AC 146 ms
79,252 KB
testcase_03 AC 146 ms
79,408 KB
testcase_04 AC 146 ms
79,240 KB
testcase_05 AC 142 ms
79,356 KB
testcase_06 AC 145 ms
79,308 KB
testcase_07 AC 144 ms
79,236 KB
testcase_08 WA -
testcase_09 AC 155 ms
79,900 KB
testcase_10 WA -
testcase_11 AC 147 ms
79,976 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 568 ms
137,308 KB
testcase_45 AC 572 ms
137,320 KB
testcase_46 TLE -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools
mod=998244353

import sys
input=sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
flg = [0] * n
ma = 0
for i in range(n):
    if ma < a[i] / b[i]:
        ma = a[i] / b[i]
        flg[i] = 1
ans = 0
l = -1
now = 1
def f(x,l,r):
    res = 0
    for i in range(l,r):
        res += a[i] / x + b[i] * x
    return res

for i in range(n):
    if flg[i]:
        if l == -1:
            l = i
        else:
            high = 10 ** 5
            low = now
            while high - low > (10 ** (-12)):
                l1 = low + (high - low) / 3
                l2 = high - (high - low) / 3
                if f(l1,l,i) > f(l2,l,i):
                    low = l1
                else:
                    high = l2
            ans += f((high+low)/2,l,i)
            l = i
            now = (high+low)/2 
high = 10 ** 5
low = now

while high - low > (10 ** (-12)):
    l1 = low + (high - low) / 3
    l2 = high - (high - low) / 3
    if f(l1,l,n) > f(l2,l,n):
        low = l1
    else:
        high = l2
ans += f((high+low)/2,l,n)

print(ans)
0