QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#730244#9576. Ordainer of Inexorable Judgmentucup-team191#WA 0ms3972kbC++231.7kb2024-11-09 19:24:022024-11-09 19:24:03

Judging History

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

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

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;
const ld PI = acos(-1);


int n, x0, yy0, d, t;

vector < pii > toc;

ld normaliziraj(ld start, ld sad) {
	sad -= start;
	while(sad < 0) sad += 2 * PI;
	while(sad >= 2 * PI) sad -= 2 * PI;
	return sad;
}

ld sijeku(ld l1, ld r1, ld l2, ld r2) {
	return max((ld)0.0, min(r1, r2) - max(l1, l2));
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> x0 >> yy0 >> d >> t;
	for(int i = 0;i < n;i++) {
		int x, y; cin >> x >> y;
		toc.pb({x, y});
	}
	ld poc = 0;
	for(int i = 0;i < n;i++) {
		int j = (i + 1) % n;
		if((toc[i].y <= 0 && toc[j].y >= 0) ||
		   (toc[i].y >= 0 && toc[j].y <= 0)) {
			poc = acos(-1);
		}
	}
	ld prvi = 1e9, zadnji = -1e9;
	for(int i = 0;i < n;i++) {
		ld delta = asin((ld)d / sqrt((ld)toc[i].x * toc[i].x + (ld)toc[i].y * toc[i].y));
		ld ang = atan2((ld)toc[i].y, (ld)toc[i].x);
		prvi = min(prvi, normaliziraj(poc, ang - delta));
		zadnji = max(zadnji, normaliziraj(poc, ang + delta));
	}
	cout << fixed << setprecision(12);
	ld ja = normaliziraj(poc, atan2((ld)yy0, (ld)x0));
	ld puni = floor(t / (2 * PI));
	ld ost = t - puni * 2 * PI;
	ld ans = 0;
	ans += (zadnji - prvi) * puni;
	ld aa = ja + ost;
	if(aa > 2 * PI) {
		aa -= 2 * PI;
		ans += sijeku(prvi, zadnji, 0, aa) + sijeku(prvi, zadnji, ja, 2 * PI);
	} else {
		ans += sijeku(prvi, zadnji, ja, aa);
	}
	cout << ans << endl;
}


详细

Test #1:

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

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

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

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

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

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

input:

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

output:

5002.653237235492

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '5002.6532372', error = '0.0006869'