結果

問題 No.139 交差点
コンテスト
ユーザー lloyz
提出日時 2023-11-23 03:54:32
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 38 ms / 5,000 ms
+ 172µs
コード長 334 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 88 ms
コンパイル使用メモリ 65,528 KB
実行使用メモリ 54,500 KB
最終ジャッジ日時 2026-10-14 11:17:09
合計ジャッジ時間 3,422 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, l = map(int, input().split())
c = 0
ans = 0
for _ in range(n):
    x, w, t = map(int, input().split())
    ans += x - c
    q, r = divmod(ans, t)
    if q % 2 == 0:
        if r + w <= t:
            ans += w
        else:
            ans += w + t + (t - r)
    else:
        ans += t - r + w
    c = x + w
ans += l - c
print(ans)
0