Index: score_memo.txt ================================================================== --- score_memo.txt +++ score_memo.txt @@ -1,17 +1,17 @@ contest1 212! -contest2 273? +contest2 280? contest3 275! contest4 561? contest5 1281? contest6 737 contest7 867? contest8 1245 contest9 3042? contest10 2076 flood1 569 -flood2 273? +flood2 280? flood3 802 flood4 970 flood5 561? trampoline1 291 trampoline2 1728? Index: src/solver.d ================================================================== --- src/solver.d +++ src/solver.d @@ -54,15 +54,20 @@ Tuple!(Pos, int)[] log; bool[][] forbidden_cell; char act(const(Game) g, string death, int breath) { - const Pos ro = g.map.robot; - const Pos[] la = g.map.lambdas(); - const Pos[] ra = g.map.razors(); - const Pos li = g.map.lift; - const Pos[] hi = g.map.objects('W'); + const Pos ro = g.map.robot; + const Pos li = g.map.lift; + Pos[] la = g.map.lambdas(); + sort!((Pos a,Pos b){ + int ad=abs(a.y-li.y)+abs(a.x-li.x); + int bd=abs(b.y-li.y)+abs(b.x-li.x); + return ad>bd;; + })(la); + Pos[] ra = g.map.razors(); + const(Pos)[] hi = g.map.objects('W'); Tuple!(char,int)[] cand; char c = 'W'; if( la.empty ) { cand = search(g, ro, [li], death); Index: src/util.d ================================================================== --- src/util.d +++ src/util.d @@ -3,10 +3,11 @@ public import std.conv; public import std.range; public import std.stdio; public import std.string; public import std.typecons; +public import std.math; import std.c.stdlib; // To avoide the following ICE: // src\phobos\std\algorithm.d(4552): // Error: function std.algorithm.count!("a == b",string,char).count