Dnia niedziela 13 wrzesieĊ„ 2009 o 09:42:12 Roshan Amadoru napisaĊ‚(a):
> Hello Everyone,
>
> Can someone explain how to solve the Square Math problem ?

struct el {
    int val; // current value of expression
    short x, y; // position
    list<char> path; // expression
} with compairsion operator comparing length of path, path itself 
(lexicographicaly), then val, x, y (in that order)

Then just simple dijkstra (starting from every point), remembering which (x, 
y, val) triples have already been visited.

Simple code with no optimization run below 4 minutes for large dataset.

Adam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to