QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#790281#9576. Ordainer of Inexorable Judgmenthei_yu_baiWA 0ms4260kbC++202.0kb2024-11-28 09:40:242024-11-28 09:40:32

Judging History

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

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

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(l - 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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 4236kb

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: 4260kb

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: 4260kb

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: 4164kb

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: 0
Accepted
time: 0ms
memory: 4168kb

input:

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

output:

4999.219115408742255

result:

ok found '4999.2191154', expected '4999.2191154', error '0.0000000'

Test #7:

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

input:

4 1 0 1 10000
-2 3300
-4 10000
-4 -10000
-2 -3300

output:

4999.200391854815280

result:

ok found '4999.2003919', expected '4999.2003919', error '0.0000000'

Test #8:

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

input:

4 -3040 2716 2147 2
-9033 -8520
-8999 -8533
-8988 -8511
-9004 -8495

output:

-4.621189757073092

result:

wrong answer 1st numbers differ - expected: '0.3508301', found: '-4.6211898', error = '4.9720198'