Блог пользователя ds_95

Автор ds_95, история, 8 лет назад, По-английски

Please help me debug my solution for this problem NEW YEAR DOMINO

My submission :14311924

My Idea :

--Treat each domino as an interval.

--Then find connected components based on intersection.

--Store range of each connected component i.e. minL,maxR.

--for each query a,b

--define cost(cc[a],cc[b]) as cost of going from one connected component to another.

--cost(cc[a],cc[b]) = minL[cc[b]]-maxR[cc[a]] (given b>a).

--However min cost = sum of costs (starting from cc[a]) to next one till cc[b] reached.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится