結果

問題 No.2010 Magical Floor
ユーザー mkawa2mkawa2
提出日時 2022-07-15 22:27:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,255 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 120,504 KB
最終ジャッジ日時 2023-09-10 03:07:44
合計ジャッジ時間 28,846 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 225 ms
89,052 KB
testcase_01 AC 244 ms
90,704 KB
testcase_02 AC 294 ms
92,076 KB
testcase_03 AC 378 ms
93,016 KB
testcase_04 AC 402 ms
93,228 KB
testcase_05 AC 467 ms
93,816 KB
testcase_06 AC 519 ms
94,836 KB
testcase_07 AC 558 ms
95,840 KB
testcase_08 AC 624 ms
95,524 KB
testcase_09 AC 667 ms
96,012 KB
testcase_10 AC 753 ms
97,116 KB
testcase_11 AC 1,809 ms
106,080 KB
testcase_12 AC 1,767 ms
106,028 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

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

from decimal import Decimal

def solve():
    n, x = LI()
    hh = [0]+LI()
    aa = LI()

    ans = inf
    mn = inf
    for i, a in enumerate(aa):
        if a >= mn: continue
        mn = a
        di = Decimal(x)
        t = Decimal(0)
        for j in range(i):
            h = hh[j+1]-hh[j]
            d = Decimal(a*h/(aa[j]**2-a**2)**0.5)
            di -= d*2
            t += (d**2+h**2).sqrt()*aa[j]*2
        if di < 0: break
        t += di*a
        ans = min(ans, t)

    print(ans)

for _ in range(II()):
    solve()
0