結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
JunOnuma
|
| 提出日時 | 2017-06-02 12:22:46 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 340 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-09-21 22:08:40 |
| 合計ジャッジ時間 | 1,375 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 22 |
ソースコード
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
JunOnuma