結果

問題 No.139 交差点
ユーザー yn
提出日時 2015-06-25 17:45:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 675 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-07 17:36:34
合計ジャッジ時間 2,575 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

n, l = map(int, input().split())

x = [0] * n
w = [0] * n
t = [0] * n

for i in range(n) :
    x[i], w[i], t[i] = map(int,input().split())

time = 0
place = 0
i = 0

while  place < l :

    if i >= n:
        place += 1
        time += 1
    else:
        if place == x[i]:
            if  time % (2 * t[i]) < t[i] and (time + w[i]) % (2 * t[i]) <= t[i]:
                place += w[i]
                time += w[i]

            else :
                time += 2 * t[i] - (time % (2 * t[i])) + w[i]
                place += w[i]


            i += 1

        elif place != x[i] and place != l-1:
            place += 1
            time += 1

print(time)
0