結果

問題 No.139 交差点
ユーザー ntuda
提出日時 2024-12-30 22:10:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,608 KB
最終ジャッジ日時 2024-12-30 22:31:11
合計ジャッジ時間 2,970 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N, L = map(int, input().split())
XWT = [list(map(int, input().split())) for _ in range(N)]
nowt = 0
nowp = 0
for x, w, t in XWT:
    t2 = t * 2
    nowt += x - nowp
    nowp = x
    if nowt % t2 <= t and (nowt + w) % t2 <= t and nowt // t2 == (nowt + w) // t2:
        continue
    else:
        nowt = - (-nowt // (2 * t)) * (2 * t)
nowt += L - nowp
print(nowt)
0