結果

問題 No.139 交差点
ユーザー ThetaTheta
提出日時 2022-11-24 16:33:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-04-08 13:55:35
合計ジャッジ時間 2,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 29 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 29 ms
9,984 KB
testcase_04 AC 29 ms
9,984 KB
testcase_05 AC 29 ms
9,984 KB
testcase_06 AC 28 ms
9,984 KB
testcase_07 AC 29 ms
9,984 KB
testcase_08 AC 30 ms
9,984 KB
testcase_09 AC 31 ms
9,984 KB
testcase_10 WA -
testcase_11 AC 29 ms
9,984 KB
testcase_12 AC 31 ms
9,984 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 30 ms
9,984 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 29 ms
9,984 KB
testcase_19 AC 29 ms
9,984 KB
testcase_20 AC 29 ms
9,984 KB
testcase_21 WA -
testcase_22 AC 28 ms
9,984 KB
testcase_23 AC 29 ms
9,984 KB
testcase_24 AC 29 ms
9,984 KB
testcase_25 AC 29 ms
9,984 KB
testcase_26 AC 29 ms
9,984 KB
testcase_27 AC 29 ms
9,984 KB
testcase_28 AC 29 ms
9,984 KB
testcase_29 AC 29 ms
9,984 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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