結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
19,424 KB
testcase_01 AC 11 ms
19,552 KB
testcase_02 AC 11 ms
19,548 KB
testcase_03 AC 11 ms
19,532 KB
testcase_04 AC 11 ms
19,540 KB
testcase_05 AC 11 ms
19,528 KB
testcase_06 AC 12 ms
19,748 KB
testcase_07 AC 11 ms
19,612 KB
testcase_08 AC 11 ms
19,820 KB
testcase_09 AC 11 ms
19,664 KB
testcase_10 AC 11 ms
19,664 KB
testcase_11 AC 19 ms
24,628 KB
testcase_12 AC 21 ms
25,764 KB
testcase_13 AC 17 ms
23,660 KB
testcase_14 AC 37 ms
36,204 KB
testcase_15 AC 55 ms
45,760 KB
testcase_16 AC 28 ms
25,340 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[2d6],b[2d6],k;
ll cost[501][501],c[2d6],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