Labels

Monday, February 28, 2011

UVA - 11631 - Dark Roads


  • ID : UVA - 11631 - Dark Roads
  • Status : Accepted
  • Type : Graph MST .
  • Time : 30 Minutes to Submission.
  • Language : Java
  • Solution :
          1. Add Total Costs of Edges.
          2. Kruskal MST on Edges using Union-Find Algorithm
          3. Subtract the MST cost from the Total cost.
  • Problems :
          1. Large Data Input so Buffered Reader & Scanner will give TLE
          2. Don't Use Java Standard Input readers but use this Parser Instead.



Java Input Parser



This is a Fast Input Parser for Java Standard Input.
It's preferred to use this one instead of both Scanner & BufferedReader as your input reader
It's working for many problems and my recent one is UVa - 11631 - Dark Roads
Enjoy :) :)




this parser was implemented by Knightry

UVA - 10307 - Killing Aliens in Borg Maze


  • ID : UVA - 10307 - Killing Aliens in Borg Maze
  • Status : Accepted
  • Type : Graph MST & BFS.
  • Time : 5 Hours to Submission.
  • Language : Java
  • Solution :
          1. Assume 'S' is a normal node as 'A'
          2. BFS on all Nodes and Find all Edges.
          3. Kruskal MST on Edges using Union-Find Algorithm
  • Problems :
          1. hashCode() Function shouldn't be implemented without equals()
          2. Hashing should be avoided with pre-indexing.