coconutnutisagiantnut's blog

By coconutnutisagiantnut, history, 6 years ago, In English

You are given a tree consisting of n vertices. Let's denote the function LCM(x,y) Least Common Multiple of (x,y) Also let's denote dist(x,y) as the number of vertices on the simple path between vertices x and y In path x to y, Neighbor verticles (a,b) all LCM(a,b)<a*b Input n number of verticles The second line contains n integers a1, a2, ..., an (1≤ai≤2⋅105) — the numbers written on vertices. Then n−1 lines follow, each containing two integers x and y (1≤x,y≤n,x≠y) denoting an edge connecting vertex x with vertex y. It is guaranteed that these edges form a tree. Output Find two verticles (x,y) tha meets the conditions.

»
6 years ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

I whill write sloution tomorrow.

»
6 years ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

Auto comment: topic has been updated by coconutnutisagiantnut (previous revision, new revision, compare).

»
6 years ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Could you elaborate more? You are defining dist(x, y) but it's never used, also I don't understand what conditions should be met. You don't clarify where a[i] are supposed to be used, and it's not verticles, it's vertices

»
6 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Looks like a problem from some ongoing Indian contest...