You are not logged in. Please login at www.codechef.com 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

2★nishant_25
101121526
accept rate: 0%

edited 01 Aug '14, 14:18

admin's gravatar image

0★admin ♦♦
19.8k350498541


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

link

answered 19 Jul '14, 12:06

Sandeepripping's gravatar image

4★Sandeepripping
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×20

question asked: 19 Jul '14, 11:22

question was seen: 591 times

last updated: 01 Aug '14, 14:18