結果

問題 No.1283 Extra Fee
ユーザー yuruhiyayuruhiya
提出日時 2020-11-07 22:33:32
言語 cLay
(20240104-1)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 2,824 ms
コンパイル使用メモリ 179,904 KB
実行使用メモリ 114,508 KB
最終ジャッジ日時 2024-04-27 23:37:14
合計ジャッジ時間 7,029 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
30,628 KB
testcase_01 AC 8 ms
28,924 KB
testcase_02 AC 9 ms
31,860 KB
testcase_03 AC 10 ms
30,780 KB
testcase_04 AC 10 ms
30,936 KB
testcase_05 AC 10 ms
29,408 KB
testcase_06 AC 9 ms
30,260 KB
testcase_07 AC 9 ms
29,912 KB
testcase_08 AC 9 ms
29,360 KB
testcase_09 AC 9 ms
32,080 KB
testcase_10 AC 9 ms
30,700 KB
testcase_11 AC 16 ms
34,244 KB
testcase_12 AC 19 ms
39,352 KB
testcase_13 AC 15 ms
33,988 KB
testcase_14 AC 31 ms
45,212 KB
testcase_15 AC 50 ms
54,180 KB
testcase_16 AC 18 ms
39,072 KB
testcase_17 AC 177 ms
107,696 KB
testcase_18 AC 185 ms
109,944 KB
testcase_19 AC 185 ms
110,924 KB
testcase_20 AC 165 ms
105,548 KB
testcase_21 AC 176 ms
109,792 KB
testcase_22 AC 148 ms
98,380 KB
testcase_23 AC 156 ms
113,352 KB
testcase_24 AC 160 ms
114,252 KB
testcase_25 AC 193 ms
113,356 KB
testcase_26 AC 189 ms
113,356 KB
testcase_27 AC 194 ms
114,508 KB
testcase_28 AC 187 ms
113,232 KB
testcase_29 AC 197 ms
114,200 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