QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#790278#9576. Ordainer of Inexorable Judgmenthei_yu_baiWA 0ms4260kbC++202.0kb2024-11-28 09:36:422024-11-28 09:36:43

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-28 09:36:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4260kb
  • [2024-11-28 09:36:42]
  • 提交

answer

#include<iostream>
using namespace std;
#include<vector>
#include<cmath>
#include<iomanip>

double slen(double x, double y) {
	return x * x + y * y;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	double pi = acos(-1);

	int n = 0, x = 0, y = 0, d = 0, t = 0;
	cin >> n >> x >> y >> d >> t;

	double beg = atan2(y, x);

	vector<pair<int, int>> point(n);
	for (int i = 0; i < n; ++i) cin >> point[i].first >> point[i].second;

	bool ok1 = false, ok2 = false;
	for (int i = 0; i < n; ++i) {
		if (point[i].first < 0 && point[i].second >= 0) ok1 = true;
		if (point[i].first < 0 && point[i].second < 0) ok2 = true;
	}

	double ans = 0;

	if (ok1 && ok2) {
		double mn = atan2(point[0].second, point[0].first);
		if (mn < 0) mn += 2 * pi;
		double mx = mn;
		for (int i = 0; i < n; ++i) {
			double f = atan2(point[i].second, point[i].first);
			if (f < 0) f += 2 * pi;
			double l = slen(point[i].first, point[i].second);
			l = atan2(d, sqrt(t - d * d));
			mx = max(mx, f + l);
			mn = min(mn, f - l);
		}
		if (beg < 0) beg += 2 * pi;
		int circle = t / (2 * pi);
		ans += circle * (mx - mn);
		double a = t - circle * 2 * pi;
		if (mn >= beg) {
			if (beg + a < mx) ans += beg + a - mn;
			else ans += mx - mn;
		}
		else {
			if (beg + a < mx) ans += a;
			else ans += mx - beg;
		}
	}
	else {
		double mn = atan2(point[0].second, point[0].first);
		double mx = mn;
		for (int i = 0; i < n; ++i) {
			double f = atan2(point[i].second, point[i].first);
			double l = slen(point[i].first, point[i].second);
			l = atan2(d, sqrt(l - d * d));
			mx = max(mx, f + l);
			mn = min(mn, f - l);
		}
		int circle = t / (2 * pi);
		ans += circle * (mx - mn);
		double a = t - circle * 2 * pi;
		if (mn >= beg) {
			if (beg + a < mx) ans += beg + a - mn;
			else ans += mx - mn;
		}
		else {
			if (beg + a < mx) ans += a;
			else ans += mx - beg;
		}
	}

	cout << fixed << setprecision(15) << ans << "\n";
	return 0;
}

詳細信息

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326794897

result:

ok found '1.5707963', expected '1.5707963', error '0.0000000'

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475477

result:

ok found '2500.7077523', expected '2500.7077523', error '0.0000000'

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290388

result:

ok found '0.3842413', expected '0.3842413', error '0.0000000'

Test #5:

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

input:

3 -10000 -10000 10000 10000
-10000 -9999
-10000 -10000
-9999 -10000

output:

2500.240670009608948

result:

ok found '2500.2406700', expected '2500.2406700', error '0.0000000'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 4228kb

input:

4 1 0 1 10000
-2 3400
-4 10000
-4 -10000
-2 -3400

output:

5030.712622403621026

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '5030.7126224', error = '0.0062997'