結果

問題 No.134 走れ!サブロー君
ユーザー yuruhiyayuruhiya
提出日時 2020-08-18 14:28:31
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 2,365 ms
コンパイル使用メモリ 164,996 KB
実行使用メモリ 6,812 KB
最終ジャッジ日時 2023-09-19 01:01:01
合計ジャッジ時間 3,517 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,700 KB
testcase_01 AC 2 ms
5,820 KB
testcase_02 AC 2 ms
5,724 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 10 ms
6,748 KB
testcase_10 AC 2 ms
5,756 KB
testcase_11 AC 2 ms
5,728 KB
testcase_12 AC 2 ms
5,700 KB
testcase_13 AC 2 ms
5,716 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;
	double sum_w = sum(w(n));
	rep(i, m) rep(j, n) dp[i][j] = ll_inf;
	rep(v, n) dp[m - 1][v] = calc(v, n, 0);
	ww[m - 1] = sum_w;
	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, sum_w);
	wt(ans + sum_w);
}
0