結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
22,692 KB
testcase_01 AC 14 ms
22,628 KB
testcase_02 AC 14 ms
22,980 KB
testcase_03 AC 14 ms
22,688 KB
testcase_04 AC 14 ms
22,912 KB
testcase_05 AC 14 ms
22,968 KB
testcase_06 AC 14 ms
22,748 KB
testcase_07 AC 15 ms
22,852 KB
testcase_08 AC 14 ms
23,096 KB
testcase_09 AC 14 ms
22,940 KB
testcase_10 AC 14 ms
22,668 KB
testcase_11 AC 21 ms
27,584 KB
testcase_12 AC 24 ms
28,848 KB
testcase_13 AC 20 ms
26,864 KB
testcase_14 AC 41 ms
39,204 KB
testcase_15 RE -
testcase_16 AC 22 ms
28,388 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[6d5],b[6d5],k;
ll cost[501][501],c[6d5],dist[6d5];
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(6d5,k,a,b,c);
	g.getDist(0,dist);
	wt(dist[to_i(n-1,n-1,1)]);
}
0