結果

問題 No.2096 Rage With Our Friends
ユーザー tailstails
提出日時 2022-10-07 22:45:05
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 5,009 ms
コンパイル使用メモリ 182,720 KB
実行使用メモリ 12,628 KB
最終ジャッジ日時 2023-09-03 14:20:09
合計ジャッジ時間 10,390 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,700 KB
testcase_01 AC 2 ms
5,504 KB
testcase_02 AC 2 ms
5,408 KB
testcase_03 AC 2 ms
5,440 KB
testcase_04 AC 2 ms
5,640 KB
testcase_05 AC 2 ms
5,440 KB
testcase_06 AC 2 ms
5,520 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,648 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 11 ms
8,548 KB
testcase_12 AC 11 ms
8,532 KB
testcase_13 WA -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

ll h,w,d[2000],e[];
char s[2000][2001];
bool on;

void f(ll x,ll y,ll t){
	rrep(u,d[y]+1,t+1){
		if(s[u][y]=='.'){
			d[y]=u;
			on=true;
			ll t2=min(h-1,u+1+max(0,x-u)/2);
			if(y>0) f(u,y-1,t2);
			if(y<w-1>0) f(u,y+1,t2);
			break;
		}
	}
}

{
	rd(h,w);
	ll@--sx,@--sy,@--gx,@--gy;
	d[0..w-1]=-1;
	d[sy]=0;
	rd(s(h));
	ll z=0;
	{
		on=false;
		if(sy>0) f(sx,sy-1,sx+1);
		if(sy<w-1) f(sx,sy+1,sx+1);
		if(d[gy]==gx){
			wt(z);
			exit(0);
		}
	}
	while(on){
		++z;
		on=false;
		e[0..w-1]=d[0..];
		rep(y,w){
			if(y>1){
				f(0,y,min(h-1,e[y-2]+1));
			}
			if(y<w-3){
				f(0,y,min(h-1,e[y+2]+1));
			}
			{
				f(0,y,min(h-1,e[y]+1));
			}
		}
		if(d[gy]==gx){
			wt(z);
			exit(0);
		}
	}
	wt(-1);
}
0