結果

問題 No.2328 Build Walls
ユーザー tailstails
提出日時 2023-05-30 14:24:59
言語 cLay
(20240104-1)
結果
AC  
実行時間 130 ms / 3,000 ms
コード長 423 bytes
コンパイル時間 4,526 ms
コンパイル使用メモリ 173,032 KB
実行使用メモリ 17,732 KB
最終ジャッジ日時 2023-08-28 00:36:51
合計ジャッジ時間 7,789 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,388 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 14 ms
11,012 KB
testcase_14 AC 43 ms
7,388 KB
testcase_15 AC 32 ms
7,332 KB
testcase_16 AC 6 ms
4,384 KB
testcase_17 AC 30 ms
8,452 KB
testcase_18 AC 3 ms
4,384 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 9 ms
8,524 KB
testcase_22 AC 66 ms
9,388 KB
testcase_23 AC 130 ms
17,412 KB
testcase_24 AC 118 ms
17,452 KB
testcase_25 AC 126 ms
17,732 KB
testcase_26 AC 90 ms
17,620 KB
testcase_27 AC 110 ms
17,572 KB
testcase_28 AC 13 ms
14,780 KB
testcase_29 AC 129 ms
17,452 KB
testcase_30 AC 18 ms
16,988 KB
testcase_31 AC 17 ms
15,936 KB
testcase_32 AC 109 ms
17,444 KB
testcase_33 AC 114 ms
17,416 KB
testcase_34 AC 20 ms
16,688 KB
testcase_35 AC 114 ms
17,560 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@h----,@w,@a[h][w];
DijkstraHeap<ll>d;
d.malloc(h*w,1);
rep(y,h){
	if(a[y][0]>=0){
		d.change(y*w,a[y][0]);
	}
}
while(d.size){
	ll b=d.pop();
	ll y=b/w;
	ll x=b%w;
	if(x<w-1){
		rep(v,y-1,y+2){
			if(v>=0&&v<h){
				rep(u,x-1,x+2){
					if(u>=0&&a[v][u]>=0){
						d.change(v*w+u,d.val[b]+a[v][u]);
					}
				}
			}
		}
	}
}
ll z=1<<30;
rep(y,h){
	if(d.visited[y*w+(w-1)]){
		z<?=d.val[y*w+(w-1)];
	}
}
wt(z>>30?-1:z);
0