結果
問題 | No.139 交差点 |
ユーザー |
![]() |
提出日時 | 2019-12-24 17:17:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 851 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-22 05:58:29 |
合計ジャッジ時間 | 2,179 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
from collections import * from heapq import * import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def main(): n, l = MI() xwt = [LI() for _ in range(n)] time = 0 pos = 0 for x, w, t in xwt: time += x - pos if time // t % 2 or (time + w - 1) // t % 2: time = (time // t + 1) * t if time // t % 2: time += t time += w pos = x + w time += l - pos print(time) main()