Closest Equals

2020 VietMX 0

You are given sequence a 1, a 2, …, a n and m queries l j, r j (1 ≤ l j ≤ r j ≤ n). For each query you need to print the minimum distance between such pair of elements a x and a y ( x ≠ y), that: both indexes of the elements […]