#K11121. Duplicate Honey Token Access Check
Duplicate Honey Token Access Check
Duplicate Honey Token Access Check
You are given a series of access events to honey tokens located in a grid. Each event is described by three integers: Xi, Yi, and Ti, which represent the x-coordinate, y-coordinate, and the time of the access respectively. A honey token is identified solely by its cell coordinate. Your task is to determine if any honey token (i.e., any grid cell) is accessed more than once.
Formally, let the sequence of events be given by: \[ (X_i, Y_i, T_i) \quad for \quad i=1,2,\ldots,k \] You need to output "DUPLICATE" if there exists at least one pair of distinct indices \(i\) and \(j\) such that \( (X_i, Y_i) = (X_j, Y_j) \). Otherwise, output "UNIQUE".
inputFormat
The first line of input contains a single integer k
denoting the number of access events.
Each of the following k
lines contains three space-separated integers: Xi
, Yi
, and Ti
, describing the coordinates of the cell and the access time.
outputFormat
Output a single line containing either DUPLICATE
if any cell is accessed more than once, or UNIQUE
if all accesses are to unique cells.
4
1 1 100
2 2 200
3 3 300
4 4 400
UNIQUE