QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#762036#9576. Ordainer of Inexorable JudgmentMeowmeowmeowWA 1ms4312kbC++171.7kb2024-11-19 12:47:092024-11-19 12:47:10

Judging History

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

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

answer

#include <bits/stdc++.h>

#define x first
#define y second

using namespace std;

typedef double db;
typedef pair<int, int> PII;

const int N = 110;
const db PI = acos(-1);

int n, sx, sy, d, t, order[N];
PII cv[N];
db rads[N], alpha[N], rr[2];

void rotate90(int &x, int &y) {
	int t = y;
	y = x, x = -t;
}
db rad(int x, int y) {
	return atan2(y, x);
}
bool check() {
	for(int i = 1; i <= n; i ++) {
		if(cv[i].x <= 0 && cv[i].y <= 0) return false;
	}
	return true;
}
db dist(int x, int y) {
	return sqrt(x*x + y*y);
}
db shift(db r) {
	db ret = r + 3./4 * PI;
	if(ret >= 2*PI) ret -= 2*PI;
	if(ret < 0) ret += 2*PI;
	return ret;
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cout << fixed << setprecision(12);
	cin >> n >> sx >> sy >> d >> t;
	int cnt = 1.*t/2/PI;
	db res = t - 1.*cnt*PI;
	for(int i = 1; i <= n; i ++) cin >> cv[i].x >> cv[i].y;
	for(int u = 0; u < 3; u ++) {
		if(check()) break;
		rotate90(sx, sy);
		for(int i = 1; i <= n; i ++) rotate90(cv[i].x, cv[i].y);
	}
	rads[0] = rad(sx, sy);
	iota(order+1, order+n+1, 1);
	for(int i = 1; i <= n; i ++) rads[i] = rad(cv[i].x, cv[i].y);
	sort(order+1, order+n+1, [](auto x, auto y) {
		return rads[x] < rads[y];
	});
	for(int i = 1; i <= n; i ++) alpha[i] = asin(1.*d/dist(cv[i].x, cv[i].y));
	rr[0] = shift(rads[order[1]] - alpha[order[1]]);
	rr[1] = shift(rads[order[n]] + alpha[order[n]]);
	db ans = 1.*cnt * (rr[1]-rr[0]);
	rads[0] = shift(rads[0]);
	if(rads[0] >= rr[0] && rads[0] <= rr[1]) {
		ans += min(rr[1]-rads[0], res);
	}
	else {
		if(res >= 2*PI-rads[0] + rr[0]) {
			res -= 2*PI-rads[0] + rr[0];
			ans += min(rr[1]-rr[0], res);
		}
	}
	cout << ans << '\n';
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4108kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326795

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290

result:

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

Test #5:

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

input:

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

output:

2500.240670009608

result:

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

Test #6:

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

input:

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

output:

5000.460304557935

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '5000.4603046', error = '0.0002483'