結果

問題 No.139 交差点
コンテスト
ユーザー ntuda
提出日時 2024-12-30 22:10:08
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 40 ms / 5,000 ms
+ 248µs
コード長 363 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 90 ms
コンパイル使用メモリ 64,640 KB
実行使用メモリ 54,536 KB
最終ジャッジ日時 2026-10-14 11:19:44
合計ジャッジ時間 3,399 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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