結果
問題 | No.139 交差点 |
ユーザー |
![]() |
提出日時 | 2016-03-25 02:57:36 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 92 ms / 5,000 ms |
コード長 | 575 bytes |
コンパイル時間 | 274 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-02 00:41:15 |
合計ジャッジ時間 | 4,569 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
コンパイルメッセージ
Syntax OK
ソースコード
class Yukicoder def initialize n, l = gets.chomp.split.map(&:to_i) time = 0 current = 0 cross = [] n.times do x, w, t = gets.chomp.split.map(&:to_i) cross << [x,w,t] end cross.each do |c| x, w, t = *c time += (x - current) current = x if (time/t).even? if (t - time%t) < w time += (t - time%t) + t + w else time += w end else time += (t - time%t) + w end current = x + w end puts time + (l - current) end end Yukicoder.new