結果

問題 No.139 交差点
コンテスト
ユーザー JunOnuma
提出日時 2017-06-02 12:22:46
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 383 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 187 ms
コンパイル使用メモリ 77,604 KB
最終ジャッジ日時 2025-12-03 23:54:03
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,l = map(int, raw_input().split())
ls = [map(int, raw_input().split()) for _ in range(n)]
time = 0
pos = 0
for [x,w,t] in ls:
    reach = time + (x-pos)
    cycle = reach / (2*t)
    if cycle * 2 * t <= x and x+w <= cycle * 2 * t + t:
        time = reach + w
    else:
        wait = (cycle+1)*2*t - reach
        time = reach + wait + w
    pos = x + w
time += l - pos
print time
0