結果
問題 |
No.139 交差点
|
ユーザー |
|
提出日時 | 2015-06-10 18:39:50 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 40 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-07-06 15:23:20 |
合計ジャッジ時間 | 1,065 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
# -*- coding:utf-8 -*- import math if __name__ == "__main__": n,l = map(int,raw_input().split()) cross =[] for i in xrange(n): xi,wi,ti = map(int,raw_input().split()) cross.append((xi,wi,ti)) ans = l loss = 0 for x,w,t in cross: start = (x+loss) / float(t) end = (x+loss+w) / float(t) if math.floor(start) % 2 == 1: if math.ceil(start) == start: start += 1 loss += t * math.ceil(start) - (x+loss) elif math.floor(end) % 2 == 1: if math.ceil(end) == end: continue loss += t * math.ceil(end) - (x+loss) print int(ans + loss)