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

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

I am trying to solve the problem 982 D — Shark. I am unable to figure out why my Solution is giving wrong answer. Can anyone help me find why I am getting a Wrong Answer? Thank You in advance.

I have used the par(), mergeSet() functions and sz, se arrays to implement the Disjoint Set. My approach is to rebuild(using array color for the same) the array after sorting and maintaining the number of segments using a map and trying to find what minimal value maximizes the number of segments.

EDIT:- I found the error, I had assumed wrongly that elements of a map would be sorted based on the second key rather than the first key and which was causing the error. I got the problem accepted.

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

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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