結果

問題 No.2404 Vertical Throw Up
ユーザー rlangevinrlangevin
提出日時 2023-08-06 18:47:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,098 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 78,496 KB
最終ジャッジ日時 2024-04-24 13:33:00
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,968 KB
testcase_01 AC 39 ms
51,968 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from bisect import *

a = int(input())
Q = int(input())
inf = 10 ** 18
D = [(-inf, -inf, -inf+1)]
C, P = [-inf], [(-inf, -inf+1)]
for _ in range(Q):
    q = list(map(int, input().split()))
    if q[0] == 1:
        s, t = q[1:]
        while D:
            x, s1, t1 = D[-1]
            if s1 + t1 + s + t == 0:
                D.pop()
                C.pop()
                P.pop()
                continue
            else:
                y = (- s * t + s1 * t1)/(s1 + t1 - s - t)
                if y <= x:
                    D.pop()
                    C.pop()
                    P.pop()
                    continue
                else:
                    D.append((y, s, t))
                    C.append(y)
                    P.append((s, t))
                    break
    else:
        # print(C, P)
        x = q[1]
        ind = bisect_right(C, x)
        s, t = P[ind - 1]
        ans = -a * (x - s) * (x - t)
        if ind <= len(P) - 1:
            s, t = P[ind]
            ans = max(ans, -a * (x - s) * (x - t))
        print(max(0, ans))
0