結果
| 問題 | No.2404 Vertical Throw Up |
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-08-06 18:47:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,098 bytes |
| 記録 | |
| コンパイル時間 | 330 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 78,784 KB |
| 最終ジャッジ日時 | 2024-11-06 21:43:21 |
| 合計ジャッジ時間 | 4,867 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 30 |
ソースコード
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))
rlangevin