QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#811099#9869. Horizon ScanningNana7#WA 1ms6212kbC++141.2kb2024-12-12 15:27:012024-12-12 15:27:02

Judging History

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

  • [2024-12-12 15:27:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6212kb
  • [2024-12-12 15:27:01]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define I inline
#define double long double
using namespace std;

const double PI = 3.14159265358;
const double eps = 1e-8;
const int N = 200100;
struct point {
	int x,y;
}a[N<<1];
char s[N];
int p[N];
int n,m,k;

I double rate(point p1,point p2,int cro) {
	double a1=atan2(p1.y,p1.x),a2=atan2(p2.y,p2.x);
	//cout<<a1<<' '<<a2<<' '<<cro<<endl;
	if(cro) return a2-a1+PI*2;
	return a2-a1;
}
I bool cmp(point p1,point p2) {
	return atan2(p1.y,p1.x)<atan2(p2.y,p2.x);
}
I void solve() {
	cin>>n>>k; 
	for(int i=1;i<=n;++i) cin>>a[i].x>>a[i].y;
	if(n==1) {
		cout<< "6.2831853072"<<endl;
		return ;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=n+1;i<=n*2;++i) a[i]=a[i-n];
	double ans=0;
	for(int i=1;i<=n;++i) {
		point l=a[i],r=a[i+k];
		double rr=rate(l,r,i+k>n);
		ans=max(ans,rr);
		cout<<"!!"<<rr<<endl;
	}
	printf("%.6Lf\n",ans);
	//cout<<ans<<endl;
} 
int main()
{
	int T; cin>>T;
	while(T--) {
		solve();
	}	
}
/*

 5
 1 1
 0 1
 8 2
 1 0
 1 1
 0 1 
 -1 1 
 -1 0 
 -1 -1
 
 0 -1
 1 -1
 4 2
 -1 1
 0 1
 0 2
 1 1
 4 2
 -1000000000 0
 -998244353 1
 
 998244353 1
 1000000000 0
 3 1
 0 1
 0 2
 0 -1
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 6212kb

input:

5
1 1
0 1
8 2
1 0
1 1
0 1
-1 1
-1 0
-1 -1
0 -1
1 -1
4 2
-1 1
0 1
0 2
1 1
4 2
-1000000000 0
-998244353 1
998244353 1
1000000000 0
3 1
0 1
0 2
0 -1

output:

6.2831853072
!!1.5708
!!1.5708
!!1.5708
!!1.5708
!!1.5708
!!1.5708
!!1.5708
!!1.5708
1.570796
!!0.785398
!!0.785398
!!5.49779
!!5.49779
5.497787
!!3.14159
!!3.14159
!!3.14159
!!3.14159
3.141593
!!3.14159
!!0
!!3.14159
3.141593

result:

wrong output format Expected double, but "!!1.5708" found