Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×
how to approach this problem ??
Difference between en7 and en8, changed 9 character(s)
you have been given tree, find a shortest path to travel from 1 to N, such that you visits some given set of nodes in your path from 1 to N. you are allowed to visit same node multiple times.↵

eg — N = 5    ↵

~~~~~↵

      1  ↵
    /  \ ↵
  2     3↵
      /   \ ↵
    4      5↵
~~~~~↵


node_to_visit_in_path = { 2 ,4 }↵

solution —  6  ( 1 -> 2 -> 1 -> 3 -> 4 -> 3 -> 5)↵

~~~~~↵
CONSTRAINTS
 — ↵
N UPTO ( 2 * 1e5 ) ↵
size of 
{node_to_visit_in_path}  : upto N-1↵
~~~~~↵


is this a famous kind of problem ?, i think similar problem i have see somewhere.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en8 English computer_jock 2023-07-26 08:26:02 9
en7 English computer_jock 2023-07-26 08:25:32 130
en6 English computer_jock 2023-07-26 08:25:01 72
en5 English computer_jock 2023-07-26 08:21:06 36
en4 English computer_jock 2023-07-26 08:20:22 132
en3 English computer_jock 2023-07-26 08:16:59 140 Tiny change: ' \n ' -> ' \n \n '
en2 English computer_jock 2023-07-26 08:10:50 9 Tiny change: ' \n ' -> ' \n \n '
en1 English computer_jock 2023-07-26 08:08:34 508 Initial revision (published)