結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,732 KB
testcase_01 AC 2 ms
5,756 KB
testcase_02 AC 2 ms
5,720 KB
testcase_03 AC 2 ms
5,768 KB
testcase_04 AC 2 ms
5,876 KB
testcase_05 AC 3 ms
5,876 KB
testcase_06 AC 5 ms
6,060 KB
testcase_07 AC 8 ms
6,292 KB
testcase_08 AC 15 ms
6,780 KB
testcase_09 AC 15 ms
6,680 KB
testcase_10 AC 2 ms
5,824 KB
testcase_11 AC 2 ms
5,716 KB
testcase_12 AC 2 ms
5,712 KB
testcase_13 AC 2 ms
5,736 KB
testcase_14 AC 2 ms
5,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int n, m, x[15], y[15], p, q;
double w[15], dp[1 << 15][15];
double calc(int i, int j, double weight) {
	return (weight + 100.0) / 120.0 * (abs(x[i] - x[j]) + abs(y[i] - y[j]));
}
double calc_s(int v, int u, int s) {
	double weight = 0;
	rep(i, n) if (!(s & (1 << i))) weight += w[i];
	return calc(v, u, weight);
}
{
	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] = calc(v, n, 0);
	rrep(s, m - 1) rep(v, n) rep(u, n) {
		if (!(s & (1 << u))) dp[s][v] <?= dp[s | (1 << u)][u] + calc_s(v, u, s);
	}
	double ans = ll_inf, sum_w = sum(w(n));
	rep(i, n) ans <?= dp[0][i] + calc(i, n, sum_w);
	wt(ans + sum_w);
}
0