Minimum Not Divisible (notdivisible)

1 teams scored 15 points on this task, for a maximum score of 15, an average score of 15 and a median score of 15.

Highlights

  1. Liceo Scientifico Vittorino da Feltre, Feltre is the institute with the most points (15).
  2. Veneto is the region with the most points (15).

Statement

You have a tree (a connected acyclic graph) of N nodes indexed from 1 to N. Each node i has an integer value V_i > 1 assigned to it. You are given Q queries, where each query i consists of two integers A_i and B_i. Your task is to find the minimum value (greater than 1) that is not divisible by any of the assigned values on the path between A_i and B_i, including the values assigned to A_i and B_i.