QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#790286#9576. Ordainer of Inexorable Judgmenthei_yu_baiWA 0ms4312kbC++202.1kb2024-11-28 09:46:592024-11-28 09:47:00

Judging History

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

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

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

	if (x < 0 && y >= 0) ok1 = true;
	if (x < 0 && y < 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(mx >= beg) {
			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 (mx >= beg){
			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: 4240kb

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

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

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

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

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

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

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

input:

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

output:

0.350830058342073

result:

ok found '0.3508301', expected '0.3508301', error '0.0000000'

Test #9:

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

input:

3 8168 -766 1549 1256
-3951 -6425
-3874 -6439
-3911 -6389

output:

84.408696855201939

result:

wrong answer 1st numbers differ - expected: '84.8328612', found: '84.4086969', error = '0.0050000'