ENG
RUS
Timus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
Discussion of Problem
2055
. Urban Geography
Show all threads
Hide all threads
Show all messages
Hide all messages
AC! + hint on avoiding TLE.
sleepntsheep
2055
. Urban Geography
12 Jan 2025 23:31
1
AC! + hint on avoiding TLE.
sleepntsheep
12 Jan 2025 23:31
good problem. dynacon!
To avoid TLE:
Use dynamic array instead of linked list for better locality.
Break early when a first spanning tree is found. (important).
Edited by author 12.01.2025 23:51
WA #4
Spatarel Dan Constantin
2055
. Urban Geography
29 Apr 2021 16:30
2
WA #4
Spatarel Dan Constantin
22 Oct 2018 23:39
input:
5 5
1 2 0
2 3 1
2 4 1
3 4 1
4 5 2
one possible output:
1 2 3 5
wrong output:
1 2 3 4 5
Don't forget that the output also needs to have as few edges as possible!
Re: WA #4
Vit Demidenko
29 Apr 2021 16:30
Obviously, size of answer is always n-1
Is there any easier solution?
Mickkie
2055
. Urban Geography
2 Nov 2015 10:28
3
Is there any easier solution?
Mickkie
28 Jun 2015 19:35
One way I can think of is to sort edge by cost
and use dynamic connectivity
But it's very hard to implement :(
What's the better solution?
Re: Is there any easier solution?
G.D.Rtop
10 Aug 2015 05:55
divide and conquer is ok. but i can't understand now .And i get T with dynamic connectivity.
Mickkie
wrote 28 June 2015 19:35
One way I can think of is to sort edge by cost
and use dynamic connectivity
But it's very hard to implement :(
What's the better solution?
Re: Is there any easier solution?
Vit Demidenko
2 Nov 2015 10:28
Lucky one, I have TL with this method.
New topic
Style:
flat
|
tree
|
nested
Thread Order:
bubble
|
fixed
© 2000–2025
Timus Online Judge Team
. All rights reserved.