pastebin

Paste #yPk -- näytä pelkkänä tekstinä -- uusi tämän pohjalta

Värjäys: Tyyli: ensimmäinen rivinumero: Tabin korvaus:

1
2
3
4
5
(function(){"use strict";

function r(r){var a=[],n=[],t=0,e=null;function f(r){return(25+r%25)%25}function o(r){return(37+r%25)%25-12}function s(r,a){return 25*f(a)+f(r)}for(var u=-1,i=7,c=[],x=i;x;--x)c[x]=(c[x+1]||0)+(9-i+x)/(5+x);function h(r,a,t,e){var f=n[s(r,a)];if(t+=f/(5+e),u=Math.max(t,u),f<0||e==i||u>t+c[e+1])return t;n[s(r,a)]=0;var o=h(r,a-1,t,e+1),x=h(r-1,a,t,e+1),l=h(r,a+1,t,e+1),v=h(r+1,a,t,e+1);return n[s(r,a)]=f,Math.max(Math.max(o,x),Math.max(l,v))}return r("Uppopallo-v1"),function(f){if("-"==f)return!1;if(e)if(t<25)for(var i=t++,c=0;c<25;++c){var x=parseInt(f.charAt(c));a[s(c,i)]=x}else{for(v=1;v<e.length;++v)e[v].s=f.charAt(v-1);for(v=0;v<e.length;++v){switch((l=e[v]).s){case"w":l.y-=1;break;case"a":l.x-=1;break;case"s":l.y+=1;break;case"d":l.x+=1}}for(v=0;v<e.length;++v){var l=e[v];a[s(l.x,l.y)]=0}}else{e=new Array(parseInt(f));for(var v=0;v<e.length;++v)e[v]={x:12,y:12,s:"s"}}if(!(t<25)){var y=e[0];!function(r){for(var t=-12;t<=12;++t)for(var f=-12;f<=12;++f)n[s(t,f)]=a[s(t,f)];for(var u=1;u<e.length;++u)for(var i=e[u],c=Math.abs(o(r.x-i.x))+Math.abs(o(r.y-i.y)),x=c>2?c>6?c>12?3:2:1:0,h=0;c&&h<=x;++h)n[s(i.x+h,i.y)]=-1,n[s(i.x-h,i.y)]=-1,n[s(i.x,i.y+h)]=-1,n[s(i.x,i.y-h)]=-1}(y),y.s=function(r,a){u=-1;var n=h(r,a-1,0,1),t=h(r-1,a,0,1),e=h(r,a+1,0,1),f=h(r+1,a,0,1);return n||t||e||f?Math.max(n,t)>Math.max(e,f)?n>t?"w":"a":e>f?"s":"d":null}(y.x,y.y)||y.s,r(y.s),1}}}

if("function"!=typeof readline)return r;for(var a=r(print);!1!==a(readline()););}())