結果

問題 No.134 走れ!サブロー君
ユーザー yuruhiyayuruhiya
提出日時 2020-08-18 15:14:38
言語 cLay
(20240104-1)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 663 bytes
コンパイル時間 2,193 ms
コンパイル使用メモリ 164,976 KB
実行使用メモリ 4,624 KB
最終ジャッジ日時 2023-09-19 01:01:20
合計ジャッジ時間 3,074 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 11 ms
4,548 KB
testcase_09 AC 10 ms
4,624 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int n, m, x[14], y[14], p, q;
double w[13], dp[1 << 13][13], ww[1 << 13];
double dist(int i, int j) {
	return abs(x[i] - x[j]) + abs(y[i] - y[j]);
}
double calc(int i, int j, double weight) {
	return (weight + 100.0) / 120.0 * dist(i, j);
}
{
	rd(p, q, n, (x, y, w)(n));
	x[n] = p;
	y[n] = q;
	m = 1 << n;
	rep(i, m) rep(j, n) dp[i][j] = ll_inf;
	rep(v, n) dp[m - 1][v] = dist(v, n) * 5.0 / 6;
	rrep(s, m - 1) rep(v, n) rep(u, n) {
		if (!(s & 1 << u)) {
			ww[s] = ww[s | 1 << u] + w[u];
			dp[s][v] <?= dp[s | 1 << u][u] + calc(v, u, ww[s]);
		}
	}
	double ans = ll_inf, k = (ww[0] + 100) / 120;
	rep(i, n) ans <?= dp[0][i] + k * dist(i, n);
	wt(ans + ww[0]);
}
0