QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#124490#5667. Meeting PlacesGenshinImpactsFaultWA 1ms6088kbC++202.8kb2023-07-14 23:22:042023-07-14 23:22:05

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-14 23:22:05]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6088kb
  • [2023-07-14 23:22:04]
  • 提交

answer

#include<bits/stdc++.h>
#define inf 1e18
#define eps 1e-9
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define fr first
#define sd second
#define db double
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
inline ll read()
{
	char ch = getchar();
	ll s = 0, w = 1;
	while (ch < '0' || ch > '9') {if (ch == '-') w = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {s = s * 10 + ch - '0'; ch = getchar();}
	return s * w;
}
#define N 2010
struct point
{
	db x, y;
	point() {x = y = 0;}
	point(db x0, db y0) {x = x0, y = y0;}
};
struct line
{
	point st, vec;
};
db sqr(const db a) {return a * a;}
point operator +(const point a, const point b) {return point(a.x + b.x, a.y + b.y);}
point operator -(const point a, const point b) {return point(a.x - b.x, a.y - b.y);}
point operator *(const db t, const point a) {return point(t * a.x, t * a.y);}
db operator *(const point a, const point b) {return a.x * b.x + a.y * b.y;}
db cross(const point a, const point b) {return a.x * b.y - a.y * b.x;}
db dis(const point a, const point b) {return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));}
point midp(const point a, const point b) {return (point) {(a.x + b.x) / 2.0, (a.y + b.y) / 2.0};}
point getcross(line a, line b)
{
	point u = a.st - b.st, v = a.vec, w = b.vec;
	db t = cross(w, u) / cross(v, w);
	return a.st + t * a.vec;
}
point sol(point a, point b, point c)
{
	point p1 = midp(a, b), p2 = midp(b, c);
	point v1 = b - a, v2 = c - b;
	swap(v1.x, v1.y); v1.x = -v1.x;
	swap(v2.x, v2.y); v2.y = -v2.y;
	return getcross((line) {p1, v1}, (line) {p2, v2});
}
int n, k, X1;
const int seed = 233811181;
point p[N];
#define N 2010
vector<pair<int, db>>G[N];
db dp[N][N];

signed main()
{
	n = read(), k = read(), X1 = read();
	ll mod = (1LL << 31) - 1, v = (1LL * X1 * seed + 1) % mod;
	p[1].x = X1, p[1].y = v;
	FOR(i, 2, n)
	{
		v = (1LL * v * seed + 1) % mod; p[i].x = v;
		v = (1LL * v * seed + 1) % mod; p[i].y = v;
	}

	// cerr << setprecision(10) ;
	// FOR(i, 1, n) cerr << p[i].x << ' ' << p[i].y << '\n';
	FOR(m, 1, n)
	{
		point O = p[m]; db R = 0.0;
		G[m].pb({m, R});
		REP(i, m, 1)if (dis(p[i], O) > R)
		{
			O = p[i], R = 0.0;
			REP(j, m, i + 1)if (dis(p[j], O) > R)
			{
				O = midp(p[i], p[j]), R = dis(O, p[i]);
				REP(k, m, j + 1)if (dis(p[k], O) > R)
				{
					O = sol(p[i], p[j], p[k]);
					R = dis(p[i], O);
				}
			}
			G[m].pb({i, R});
			// cerr << "??:" << i << " " << m << " " << R << '\n';
		}
		G[m].pb({1, R});
	}
	FOR(i, 0, n)FOR(j, 0, k)dp[i][j] = inf;
	dp[0][0] = 0;
	FOR(j, 1, k)FOR(i, 1, n)
	{
		for (auto [ti, v] : G[i])
		{
			dp[i][j] = min(dp[i][j], dp[ti - 1][j - 1] + v);
		}
	}
	printf("%.20lf\n", dp[n][k]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 6088kb

input:

100 23 213

output:

1319350480.80073261260986328125

result:

ok found '1319350480.8007326', expected '1319350480.8007326', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 5740kb

input:

10 1 1060

output:

1042753143.34516763687133789062

result:

ok found '1042753143.3451676', expected '1042753143.3451676', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

10 10 2373

output:

0.00000000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

10 2 3396

output:

1236610536.94692301750183105469

result:

ok found '1236610536.9469230', expected '1236610536.9469230', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 5784kb

input:

10 3 1998

output:

1003099517.70727252960205078125

result:

wrong answer 1st numbers differ - expected: '973790809.8224442', found: '1003099517.7072725', error = '0.0300975'