QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#762115#9576. Ordainer of Inexorable JudgmentMeowmeowmeowWA 0ms4248kbC++172.1kb2024-11-19 13:41:262024-11-19 13:41:27

Judging History

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

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

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;
	ret = ret - int(ret/2/PI)*2*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*2*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);
	for(int i = 1; i <= n; i ++) alpha[i] = asin(1.*d/dist(cv[i].x, cv[i].y));
	sort(order+1, order+n+1, [](auto x, auto y) {
		return shift(rads[x]-alpha[x]) < shift(rads[y]-alpha[y]);
	});
	rr[0] = shift(rads[order[1]] - alpha[order[1]]);
	sort(order+1, order+n+1, [](auto x, auto y) {
		return shift(rads[x]+alpha[x]) < shift(rads[y]+alpha[y]);
	});
	rr[1] = shift(rads[order[n]] + alpha[order[n]]);
	// cerr << rr[0] << ' ' << rr[1] << '\n';
	db ans = 1.*cnt * (rr[1]-rr[0]);
	// cerr << ans << '\n';
	rads[0] = shift(rads[0]);
	if(rads[0] >= rr[0] && rads[0] <= rr[1]) {
		ans += min(rr[1]-rads[0], res);
	}
	else {
		if(rads[0] > rr[1] && res >= 2*PI-rads[0] + rr[0]) {
			res -= 2*PI-rads[0] + rr[0];
			ans += min(rr[1]-rr[0], res);
		}
		if(rads[0] < rr[0] && res >= rr[0]-rads[0]) {
			res -= rr[0]-rads[0];
			ans += min(rr[1]-rr[0], res);
		}
	}
	cout << ans << '\n';
	return 0;
}

詳細信息

Test #1:

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

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

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

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

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

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

input:

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

output:

4999.219115408742

result:

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

Test #7:

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

input:

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

output:

4999.200391854815

result:

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

Test #8:

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

input:

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

output:

0.350830058342

result:

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

Test #9:

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

input:

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

output:

84.832861161007

result:

ok found '84.8328612', expected '84.8328612', error '0.0000000'

Test #10:

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

input:

8 2977 -3175 8766 2
-4868 7759
-4867 7925
-4867 7950
-4886 7952
-4979 7953
-5048 7877
-5003 7761
-4936 7759

output:

0.327860646906

result:

ok found '0.3278606', expected '0.3278606', error '0.0000000'

Test #11:

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

input:

13 -1715 -4640 267 8651
272 6659
264 6660
208 6664
108 6625
107 6621
93 6564
90 6551
90 6485
124 6474
219 6477
283 6525
288 6591
286 6657

output:

153.589622784682

result:

ok found '153.5896228', expected '153.5896228', error '0.0000000'

Test #12:

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

input:

8 -9743 -7629 775 7
-194 981
-191 1720
-193 1845
-705 1929
-959 1950
-1131 1894
-1151 1604
-1031 1020

output:

2.046006204356

result:

ok found '2.0460062', expected '2.0460062', error '0.0000000'

Test #13:

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

input:

9 -6770 -1426 3491 1918
-2118 2886
-2063 3245
-2122 3709
-2129 3737
-2850 3718
-2984 3650
-3042 3462
-3028 2972
-2688 2888

output:

822.241184963715

result:

ok found '822.2411850', expected '822.2411850', error '0.0000000'

Test #14:

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

input:

12 1616 -7384 5256 10
-5607 2623
-5838 2843
-6117 2986
-6592 3169
-7129 3120
-7334 3069
-7406 2295
-7369 1712
-7091 1287
-6312 1252
-5596 1592
-5457 2088

output:

2.948316905947

result:

wrong answer 1st numbers differ - expected: '3.0387654', found: '2.9483169', error = '0.0297649'