結果

問題 No.139 交差点
ユーザー fine
提出日時 2016-03-28 11:21:55
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-10-02 06:00:13
合計ジャッジ時間 4,246 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

ans = now = 0
n, l = gets.split.map(&:to_i)
n.times{
    x, w, t = gets.split.map(&:to_i)
    ans += x - now
    now = x
    if (ans / t) % 2 == 1
        ans = (ans / t + 1) * t + w
    elsif((ans + w) / t) % 2 == 1
        ans = ((ans + w) / t + 1) * t + w
    else
        ans += w
    end
    now += w
    }
p ans + l - now
0