You are not logged in. Please login at to post your questions!


Why author's solution of DISHOWN problem showing TLE

I am trying to understand the solution of DISHOWN problem through the author's solution.

I fully understand the logic through code. But when I was trying to submit the same code it is showing TLE..

Please help.

This is my submitted code. I just copied and pasted the author's solution.

asked 19 Jul '14, 11:22

nishant_25's gravatar image

accept rate: 0%

edited 01 Aug '14, 14:18

admin's gravatar image

0★admin ♦♦

U forgot the part where he mentioned path compression heuristics. Path compression is really important in this problem. I had a similar problem during the contest but after applying path compression i got AC :). Hope this helps. U can check my submission if u want pointers on how to implement path compression , altough i would prefer if u googled and learnt it on your own


answered 19 Jul '14, 12:06

Sandeepripping's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 19 Jul '14, 11:22

question was seen: 591 times

last updated: 01 Aug '14, 14:18