結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-03 00:14:24 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 567 bytes |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-07 22:31:50 |
| 合計ジャッジ時間 | 2,009 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 7 |
ソースコード
def read_data():
N, L = map(int, input().split())
xwt = []
for i in range(N):
x, w, t = map(int, input().split())
xwt.append((x, w, t))
return N, L, xwt
def solve(N, L, xwt):
time = 0
pos = 0
for x, w, t in xwt:
time += x - pos
red_start = (time // t) % 2
red_goal = ((time + w) // t) % 2
if red_start or red_goal:
time = ((time // (2 * t)) + 1) * (2 * t)
time += w
pos = x + w
time += L - pos
return time
N, L, xwt = read_data()
print(solve(N, L, xwt))