結果

問題 No.1413 Dynamic Sushi
ユーザー kwm_tkwm_t
提出日時 2021-03-01 22:49:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,867 bytes
コンパイル時間 4,713 ms
コンパイル使用メモリ 227,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 03:56:51
合計ジャッジ時間 25,920 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 843 ms
6,940 KB
testcase_05 AC 1,039 ms
6,944 KB
testcase_06 AC 1,046 ms
6,944 KB
testcase_07 AC 1,019 ms
6,944 KB
testcase_08 AC 962 ms
6,940 KB
testcase_09 AC 1,086 ms
6,940 KB
testcase_10 AC 1,051 ms
6,940 KB
testcase_11 AC 1,041 ms
6,940 KB
testcase_12 AC 978 ms
6,940 KB
testcase_13 AC 936 ms
6,940 KB
testcase_14 AC 1,070 ms
6,944 KB
testcase_15 AC 1,062 ms
6,940 KB
testcase_16 AC 1,085 ms
6,944 KB
testcase_17 AC 1,064 ms
6,944 KB
testcase_18 AC 1,045 ms
6,940 KB
testcase_19 AC 1,050 ms
6,940 KB
testcase_20 AC 435 ms
6,940 KB
testcase_21 AC 6 ms
6,940 KB
testcase_22 AC 1,012 ms
6,940 KB
testcase_23 AC 953 ms
6,944 KB
testcase_24 AC 977 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#include "atcoder/all"
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
double dp[100005][2];
int X[12];
int Y[12];
int R[12];
int V[12];
int A[12];
int N, W;
double PI = acos(-1.0);
double calc(double x0, double y0, double t0, int i) {
	double ng = t0;
	double ok = INF;
	for (int n = 0; n < 50; ++n) {
		double mid = (ok + ng) / 2;
		double x1 = X[i] + R[i] * cos((V[i] * mid + A[i])*PI / 180) - x0;
		double y1 = Y[i] + R[i] * sin((V[i] * mid + A[i])*PI / 180) - y0;
		if ((x1*x1 + y1 * y1) <= (double)W*W*(mid - t0)*(mid - t0)) {
			ok = mid;
		}
		else {
			ng = mid;
		}
	}
	return ok;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> N >> W;
	rep(i, N) {
		cin >> X[i] >> Y[i] >> R[i] >> V[i] >> A[i];
	}
	//巡回セールスマン
	vector<vector<double>> dp(1 << N, vector<double>(N, INF));
	rep(i, N) {
		//初期値
		dp[1 << i][i] = calc(0.0, 0.0, 0.0, i);
	}
	rep(i, (1 << N)) {
		rep(j, N) {
			if (INF == dp[i][j]) {
				continue;
			}
			rep(k, N) {
				int next = i | (1 << k);
				double t = dp[i][j];
				double x = X[j] + R[j] * cos((V[j] * t + A[j])*PI / 180);
				double y = Y[j] + R[j] * sin((V[j] * t + A[j])*PI / 180);
				double time = calc(x, y, t, k);
				dp[next][k] = min(dp[next][k], time);
			}
		}
	}
	double ans = INF;
	for (int i = 0; i < N; ++i) {
		ans = min(dp[(1 << N) - 1][i], ans);
	}
	printf("%.10f\n", ans);
	return 0;
}
0