結果

問題 No.1283 Extra Fee
ユーザー yuruhiyayuruhiya
提出日時 2020-11-07 22:26:42
言語 cLay
(20240104-1)
結果
RE  
実行時間 -
コード長 571 bytes
コンパイル時間 2,820 ms
コンパイル使用メモリ 176,964 KB
実行使用メモリ 49,288 KB
最終ジャッジ日時 2023-09-19 01:48:46
合計ジャッジ時間 13,595 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
32,284 KB
testcase_01 AC 13 ms
32,076 KB
testcase_02 AC 12 ms
32,152 KB
testcase_03 AC 12 ms
32,020 KB
testcase_04 AC 12 ms
32,072 KB
testcase_05 AC 12 ms
32,204 KB
testcase_06 AC 12 ms
32,144 KB
testcase_07 AC 12 ms
32,216 KB
testcase_08 AC 12 ms
32,024 KB
testcase_09 AC 12 ms
32,004 KB
testcase_10 AC 12 ms
32,204 KB
testcase_11 AC 19 ms
38,432 KB
testcase_12 AC 21 ms
38,196 KB
testcase_13 AC 17 ms
36,256 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 20 ms
38,276 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

int n,m,a[5d5],b[5d5],k;
ll cost[501][501],c[5d5],dist[5d5];
int to_i(int x,int y,int f){return (y*n+x)*2+f;}
{
	rd(n,m);
	rep(i,m){
		ll@h,@w,@c;
		cost[h-1][w-1]=c;
	}
	VI d{1,0,-1,0,1};
	rep(i,n)rep(j,n)rep(_,4){
		int y=i+d[_],x=j+d[_+1];
		if(0<=x<n&&0<=y<n){
			a[k]=to_i(j,i,0);
			b[k]=to_i(x,y,0);
			c[k]=cost[y][x]+1;
			k++;
			a[k]=to_i(j,i,0);
			b[k]=to_i(x,y,1);
			c[k]=1;
			k++;
			a[k]=to_i(j,i,1);
			b[k]=to_i(x,y,1);
			c[k]=cost[y][x]+1;
			k++;
		}
	}
	wgraph<ll>g;
	g.setDirectEdge(5d5,k,a,b,c);
	g.getDist(0,dist);
	wt(dist[to_i(n-1,n-1,1)]);
}
0