Skip to content

relocation

bradendubois edited this page Nov 8, 2021 · 8 revisions

Relocation

ID: relocation

Difficulty: 1.5

CPU Time: 1 second

Memory: 1024 MB

Solution

For this problem, one can intially map out all the locations of each of the N companies, then, for the next Q lines, read in A, B, C. If A == 1. simply set B = C, otherwise print the absolute difference between the locations of B and C.

Clone this wiki locally