QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#829724#9576. Ordainer of Inexorable Judgment1145141919#WA 1ms4452kbC++172.5kb2024-12-24 12:35:062024-12-24 12:35:07

Judging History

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

  • [2024-12-24 12:35:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4452kb
  • [2024-12-24 12:35:06]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,l,r) for(int i=l,i##_e=r;i<=i##_e;++i)
#define rFor(i,r,l) for(int i=r,i##_e=l;i>=i##_e;--i)
#define y0 y_zero
#define y1 y_one
#define all(a) a.begin(),a.end()
#define cmin(a,b) a=min(a,b)
#define cmax(a,b) a=max(a,b)
#define vect basic_string
// #define ensure(_) if(!(_)) __builtin_unreachable();
using namespace std;
using u32=unsigned;
using i64=long long;
using ll=long long;
using u64=unsigned long long;
using ull=unsigned long long;
#if __SIZEOF_POINTER__==8
using i128=__int128;
using u128=__uint128_t;
#endif
using pii=array<int,2>;
using pll=array<ll,2>;
using a3=array<int,3>;
using a4=array<int,4>;
#define mtc() int T; cin>>T; while(T--) work();

using D=double;
const int N=110;
const double pi=acos(-1),eps=1e-8;
struct nd {
	int x,y;
	void rev() {x=-x;y=-y;}
	double getr() {
		double s=atan2(y,x);
		return s<0?s+pi*2:s;
	}
	pair<D,D> rot(D a){return {x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)};}
};
int n,d; double t;
nd a0,a[N];
double b[N];
bool chk1() {
	For(i,1,n) if(a[i].x>=0 && abs(a[i].y)<=d) return 1;
	bool f1=0,f2=0;
	For(i,1,n) if(a[i].x>=0) {
		if(a[i].y<0) f1=1;
		else if(a[i].y>0) f2=1;
	}
	return f1 && f2;
}
int main() {
#ifdef LOCAL
	freopen(".in","r",stdin);
	// freopen(".out","w",stdout);
	// freopen(".debug","w",stderr);
#endif
#ifndef with_buffer
	ios::sync_with_stdio(0); cin.tie(0);
#endif
	cin>>n>>a0.x>>a0.y>>d>>t;
	auto [X,Y]=a0.rot(pi);
	For(i,1,n) cin>>a[i].x>>a[i].y;
	if(chk1()) {
		For(i,1,n) a[i].rev(); a0.rev();
	}
	For(i,1,n) b[i]=a[i].getr();
	// For(i,1,n) cerr<<b[i]<<" "; cerr<<"\n";
	double l,r,l1=0,r1=*min_element(b+1,b+n+1); cmax(l1,r1-pi/2);
	while(l1+eps<r1) {
		double m=(l1+r1)/2;
		bool fl=0;
		For(i,1,n) if(abs(b[i]-m)<=pi/2) {
			fl|=a[i].rot(-m).second<d;
		}
		if(fl) r1=m; else l1=m;
	}
	l=(l1+r1)/2;
	l1=*max_element(b+1,b+n+1),r1=pi*2; cmin(r1,l1+pi/2);
	while(l1+eps<r1) {
		double m=(l1+r1)/2;
		bool fl=0;
		// cerr<<l1<<" "<<m<<" "<<r1<<"\n";
		For(i,1,n) if(abs(b[i]-m)<=pi/2) {
			fl|=a[i].rot(-m).second>-d;
			// cerr<<a[i].rot(-m).second<<" ";
		}
		// cerr<<fl<<" "<<"\n";
		if(fl) l1=m; else r1=m;
	}
	r=(l1+r1)/2;
	cerr<<l<<" "<<r<<"\n";
	auto calc=[&](D L,D R) {
		return max(0.,min(r,R)-max(l,L));
	};
	double p0=a0.getr(),s=0;
	if(p0+t<=pi*2) s+=calc(p0,p0+t),t=0;
	else s+=calc(p0,pi*2),t-=pi*2-p0;
	if(t>eps) {
		int k=t/(pi*2);
		s+=k*calc(0,pi*2);
		s+=calc(0,t-k*pi*2);
	}
	cout<<setprecision(10)<<s<<"\n";
}

詳細信息

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796327

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707754

result:

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

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 4452kb

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.3842444665

result:

wrong answer 1st numbers differ - expected: '0.3842413', found: '0.3842445', error = '0.0000032'