結果

問題 No.2010 Magical Floor
ユーザー Kiri8128Kiri8128
提出日時 2020-11-22 01:54:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 442 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 8,520 KB
最終ジャッジ日時 2023-09-20 10:20:10
合計ジャッジ時間 3,962 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,036 KB
testcase_01 AC 17 ms
8,088 KB
testcase_02 AC 19 ms
8,140 KB
testcase_03 AC 19 ms
8,044 KB
testcase_04 AC 19 ms
7,864 KB
testcase_05 AC 19 ms
7,992 KB
testcase_06 AC 19 ms
8,148 KB
testcase_07 AC 19 ms
8,124 KB
testcase_08 AC 20 ms
7,952 KB
testcase_09 AC 20 ms
7,912 KB
testcase_10 AC 19 ms
8,068 KB
testcase_11 AC 30 ms
7,944 KB
testcase_12 AC 30 ms
7,996 KB
testcase_13 AC 32 ms
8,032 KB
testcase_14 AC 34 ms
7,920 KB
testcase_15 AC 33 ms
8,340 KB
testcase_16 AC 33 ms
7,996 KB
testcase_17 AC 33 ms
8,520 KB
testcase_18 AC 34 ms
7,956 KB
testcase_19 AC 432 ms
8,456 KB
testcase_20 AC 442 ms
8,344 KB
testcase_21 AC 178 ms
8,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
T = int(input())
for _ in range(T):
    N, X = map(int, input().split())
    H = [int(a) for a in input().split()]
    A = [int(a) for a in input().split()]
    HH = [H[0]] + [h2 - h1 for h1, h2 in zip(H, H[1:])]
    mi = ans = 1 << 60
    for i in range(N):
        if A[i] >= mi: continue
        mi = A[i]
        t = 0
        sx = 0
        for j in range(i):
            a = A[i] / A[j]
            b = sqrt(1 - a ** 2)
            t += A[j] * HH[j] / b
            sx += a * HH[j] / b
        if sx * 2 > X: continue
        t += (X / 2 - sx) * A[i]
        if t * 2 < ans:
            ans = t * 2
    print(ans)
0