結果

問題 No.1283 Extra Fee
ユーザー tailstails
提出日時 2020-11-06 22:46:27
言語 cLay
(20240104-1)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 2,764 ms
コンパイル使用メモリ 175,912 KB
実行使用メモリ 19,452 KB
最終ジャッジ日時 2024-04-27 23:24:07
合計ジャッジ時間 5,218 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,688 KB
testcase_01 AC 2 ms
11,728 KB
testcase_02 AC 2 ms
13,788 KB
testcase_03 AC 2 ms
9,556 KB
testcase_04 AC 3 ms
11,732 KB
testcase_05 AC 3 ms
9,684 KB
testcase_06 AC 2 ms
13,808 KB
testcase_07 AC 2 ms
11,732 KB
testcase_08 AC 2 ms
9,588 KB
testcase_09 AC 3 ms
9,708 KB
testcase_10 AC 3 ms
9,576 KB
testcase_11 AC 7 ms
14,228 KB
testcase_12 AC 9 ms
12,344 KB
testcase_13 AC 6 ms
14,044 KB
testcase_14 AC 18 ms
14,684 KB
testcase_15 AC 28 ms
14,816 KB
testcase_16 AC 8 ms
12,404 KB
testcase_17 AC 76 ms
17,264 KB
testcase_18 AC 93 ms
16,724 KB
testcase_19 AC 98 ms
16,956 KB
testcase_20 AC 90 ms
19,324 KB
testcase_21 AC 94 ms
17,400 KB
testcase_22 AC 84 ms
17,096 KB
testcase_23 AC 60 ms
16,564 KB
testcase_24 AC 61 ms
16,440 KB
testcase_25 AC 100 ms
19,452 KB
testcase_26 AC 103 ms
16,464 KB
testcase_27 AC 98 ms
16,616 KB
testcase_28 AC 98 ms
16,788 KB
testcase_29 AC 87 ms
16,504 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