結果
問題 |
No.139 交差点
|
ユーザー |
![]() |
提出日時 | 2015-11-11 16:27:43 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 654 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 14:26:16 |
合計ジャッジ時間 | 1,780 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#!/usr/bin/python # -*- coding: utf-8 -*- N, L = map(int, raw_input().split()) time, location = 0, 0 for loop in xrange(N): X, W, T = map(int, raw_input().split()) # 信号まで歩く time += X - location location = X # 始点と終点で青ならわたっておk if 0 <= time % (2*T) < T and 0 <= (time+W-1) % (2*T) < T: time += W location += W # 行けなかったら次の青まで待つ else: nextgreen = (time/(2*T) + 1) * (2*T) time += nextgreen - time time += W location += W time += (L - location) # 君の家に着くまでずっと走ってゆく print time