結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,764 KB
testcase_01 AC 2 ms
5,792 KB
testcase_02 AC 2 ms
5,704 KB
testcase_03 AC 2 ms
5,760 KB
testcase_04 AC 3 ms
5,796 KB
testcase_05 AC 3 ms
5,832 KB
testcase_06 AC 4 ms
5,996 KB
testcase_07 AC 6 ms
6,228 KB
testcase_08 AC 11 ms
6,804 KB
testcase_09 AC 11 ms
6,728 KB
testcase_10 AC 2 ms
5,792 KB
testcase_11 AC 2 ms
5,716 KB
testcase_12 AC 2 ms
5,780 KB
testcase_13 AC 2 ms
5,792 KB
testcase_14 AC 2 ms
5,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int n, m, x[15], y[15], p, q;
double w[15], dp[1 << 15][15], ww[1 << 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]));
}
{
	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)) {
			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;
	rep(i, n) ans <?= dp[0][i] + calc(i, n, ww[0]);
	wt(ans + ww[0]);
}
0