結果

問題 No.139 交差点
ユーザー rlangevin
提出日時 2023-02-24 08:55:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 256 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 82,472 KB
実行使用メモリ 52,736 KB
最終ジャッジ日時 2024-07-26 12:50:26
合計ジャッジ時間 2,831 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N, L = map(int, input().split())
ans, pre = 0, 0
for i in range(N):
    X, W, T = map(int, input().split())
    now = (ans + X - pre) % (2 * T)
    if T - now < W:
        ans += 2 * T - now
    ans += X + W - pre
    pre = X + W
ans += L - pre
print(ans) 
0