Editorial for THICC '17 P3 - The God of Death
                Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
                Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
This problem can be solved trivially with persistent data structures in .
Time Complexity: 
Alternatively, one can create an array for each target, representing each movement with <day, location>. Since the days are monotonically increasing, each query can be answered in  with binary search.
Time Complexity: 
Comments