Descriptions:

Little Artem and Time Machine

CodeForces - 641E