結果

問題 No.1283 Extra Fee
ユーザー tailstails
提出日時 2020-11-06 22:46:27
言語 cLay
(20231016-1)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 3,946 ms
コンパイル使用メモリ 174,148 KB
実行使用メモリ 16,808 KB
最終ジャッジ日時 2023-08-10 06:06:10
合計ジャッジ時間 5,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,484 KB
testcase_01 AC 3 ms
9,480 KB
testcase_02 AC 3 ms
9,500 KB
testcase_03 AC 3 ms
9,612 KB
testcase_04 AC 3 ms
9,536 KB
testcase_05 AC 3 ms
9,528 KB
testcase_06 AC 3 ms
9,500 KB
testcase_07 AC 3 ms
9,536 KB
testcase_08 AC 3 ms
9,508 KB
testcase_09 AC 3 ms
9,512 KB
testcase_10 AC 3 ms
9,500 KB
testcase_11 AC 8 ms
12,148 KB
testcase_12 AC 10 ms
12,388 KB
testcase_13 AC 7 ms
12,048 KB
testcase_14 AC 20 ms
12,952 KB
testcase_15 AC 31 ms
13,752 KB
testcase_16 AC 9 ms
12,204 KB
testcase_17 AC 92 ms
16,348 KB
testcase_18 AC 102 ms
16,696 KB
testcase_19 AC 104 ms
16,808 KB
testcase_20 AC 98 ms
16,552 KB
testcase_21 AC 99 ms
16,620 KB
testcase_22 AC 89 ms
16,544 KB
testcase_23 AC 65 ms
16,660 KB
testcase_24 AC 67 ms
16,604 KB
testcase_25 AC 108 ms
16,648 KB
testcase_26 AC 108 ms
16,644 KB
testcase_27 AC 107 ms
16,656 KB
testcase_28 AC 107 ms
16,656 KB
testcase_29 AC 99 ms
16,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll fe[512][512];
{
	ll @n,@m;
	rep(m){
		ll @h,@w,@c;
		fe[h][w]=c;
	}
	DijkstraHeap<ll> h;
	ll hs=1<<19;
	h.walloc(hs);
	h.init(hs);
	h.change(1<<10|1<<1|0,0);
	while(h.size){
		ll a=h.pop();
		ll v=h.val[a];
		ll y=a>>10;
		ll x=a>>1&(511);
		if(a&1){
			if(y>1){
				h.change(a-(1<<10),v+fe[y-1][x]+1);
			}
			if(y<n){
				h.change(a+(1<<10),v+fe[y+1][x]+1);
			}
			if(x>1){
				h.change(a-(1<<1),v+fe[y][x-1]+1);
			}
			if(x<n){
				h.change(a+(1<<1),v+fe[y][x+1]+1);
			}
		}else{
			if(y>1){
				h.change(a-(1<<10),v+fe[y-1][x]+1);
				h.change(a-(1<<10)+1,v+1);
			}
			if(y<n){
				h.change(a+(1<<10),v+fe[y+1][x]+1);
				h.change(a+(1<<10)+1,v+1);
			}
			if(x>1){
				h.change(a-(1<<1),v+fe[y][x-1]+1);
				h.change(a-(1<<1)+1,v+1);
			}
			if(x<n){
				h.change(a+(1<<1),v+fe[y][x+1]+1);
				h.change(a+(1<<1)+1,v+1);
			}
		}
	}
	wt(h.val[n<<10|n<<1|1]);
}
0