結果

問題 No.139 交差点
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-01-21 17:27:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 73,160 KB
最終ジャッジ日時 2023-09-06 05:59:11
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
72,636 KB
testcase_01 AC 96 ms
72,760 KB
testcase_02 AC 91 ms
72,968 KB
testcase_03 AC 98 ms
72,820 KB
testcase_04 AC 97 ms
72,840 KB
testcase_05 AC 97 ms
72,780 KB
testcase_06 AC 96 ms
72,796 KB
testcase_07 AC 96 ms
73,020 KB
testcase_08 AC 97 ms
73,040 KB
testcase_09 AC 97 ms
72,768 KB
testcase_10 AC 92 ms
72,848 KB
testcase_11 AC 95 ms
72,768 KB
testcase_12 AC 99 ms
72,604 KB
testcase_13 AC 100 ms
72,828 KB
testcase_14 AC 97 ms
72,772 KB
testcase_15 AC 94 ms
72,592 KB
testcase_16 AC 97 ms
72,836 KB
testcase_17 AC 95 ms
72,848 KB
testcase_18 AC 93 ms
72,916 KB
testcase_19 AC 92 ms
73,120 KB
testcase_20 AC 96 ms
72,764 KB
testcase_21 AC 94 ms
72,792 KB
testcase_22 AC 93 ms
73,160 KB
testcase_23 AC 94 ms
72,776 KB
testcase_24 AC 93 ms
72,848 KB
testcase_25 AC 98 ms
73,132 KB
testcase_26 AC 99 ms
72,880 KB
testcase_27 AC 93 ms
72,932 KB
testcase_28 AC 93 ms
72,896 KB
testcase_29 AC 96 ms
72,828 KB
testcase_30 AC 94 ms
73,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N,L = map(int,input().split())
XWT = [tuple(map(int,input().split())) for _ in range(N)]
now = 0
time = 0
for x,w,T in XWT:
    time += x-now
    now = x
    if time//T%2==0:
        if (time+w-1)//T==time//T:
            now = x+w
            time += w
        else:
            now = x+w
            time = w + T*(time//T + 2)
    else:
        now = x+w
        time = w + T*(time//T + 1)
print(time + L - now)
0