結果

問題 No.1283 Extra Fee
ユーザー yuruhiyayuruhiya
提出日時 2020-11-07 22:33:32
言語 cLay
(20240104-1)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 177,812 KB
実行使用メモリ 121,196 KB
最終ジャッジ日時 2023-08-10 06:19:29
合計ジャッジ時間 7,130 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
32,084 KB
testcase_01 AC 12 ms
31,988 KB
testcase_02 AC 13 ms
32,100 KB
testcase_03 AC 12 ms
32,032 KB
testcase_04 AC 13 ms
31,992 KB
testcase_05 AC 12 ms
32,304 KB
testcase_06 AC 12 ms
31,996 KB
testcase_07 AC 12 ms
32,040 KB
testcase_08 AC 12 ms
32,040 KB
testcase_09 AC 13 ms
32,164 KB
testcase_10 AC 12 ms
32,048 KB
testcase_11 AC 20 ms
40,176 KB
testcase_12 AC 21 ms
40,224 KB
testcase_13 AC 17 ms
34,540 KB
testcase_14 AC 37 ms
48,908 KB
testcase_15 AC 55 ms
59,592 KB
testcase_16 AC 20 ms
40,424 KB
testcase_17 AC 173 ms
112,624 KB
testcase_18 AC 164 ms
114,888 KB
testcase_19 AC 175 ms
116,816 KB
testcase_20 AC 165 ms
112,772 KB
testcase_21 AC 163 ms
114,820 KB
testcase_22 AC 149 ms
104,592 KB
testcase_23 AC 145 ms
120,912 KB
testcase_24 AC 152 ms
120,956 KB
testcase_25 AC 181 ms
121,196 KB
testcase_26 AC 183 ms
121,188 KB
testcase_27 AC 174 ms
121,012 KB
testcase_28 AC 182 ms
120,968 KB
testcase_29 AC 179 ms
120,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int n,m,a[6d6],b[6d6],k;
ll cost[501][501],c[6d6],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