Please subscribe to the official Codeforces channel in Telegram via the link: ×

mohamedeltair's blog

By mohamedeltair, history, 2 months ago, In English,

The problem I am referring to in this question is: Traffic Light

It is mentioned in the question that: "Formally, Mr. Ang can set the offsets for the traffic lights to OFFi so that for each traffic light, Mr. Ang can go through it in time range [OFFi + k × (Ai + Bi), OFFi + k × (Ai + Bi) + Ai) and must wait in time range [OFFi + k × (Ai + Bi) + Ai, OFFi + (k + 1) × (Ai + Bi)) for all integers k."

But I don't understand what the offsets actually mean here. If Mr. Ang is moving from his home at time 0 and offsets represent absolute time by which he can control the start of green light, so he can adjust the offsets to never wait at any traffic light, but this is not the case in the problem. Any help in understanding this is appreciated.


2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

For example if you consider the second sample test, he adjusted OFF1=0 and OFF2=25, so that in the worst case he has to wait only in the red of the first traffic light. Still I don't understand how is this related to the problem statement (specifically the equations part).