結果

問題 No.139 交差点
ユーザー Theta
提出日時 2022-11-24 16:33:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-01 06:55:03
合計ジャッジ時間 1,849 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_blue(current: int, interval: int) -> bool:
    return (current // interval) % 2 == 0


def main():
    N, L = map(int, input().split())
    route = [list(map(int, input().split())) for _ in range(N)]

    current_x = 0
    current_t = 0

    for cross_x, cross_w, interval in route:
        current_t += cross_x - current_x
        current_x = cross_x

        if not is_blue(current_t, interval):
            current_t += (interval - (current_t % interval))
        elif not is_blue(current_t + cross_w, interval):
            current_t += (2 * interval - (current_t % interval))

        current_t += cross_w
        current_x += cross_w

    current_t += L - current_x
    current_x = L
    print(current_t)


if __name__ == "__main__":
    main()
0