QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#41319#4418. Laser AlarmDaBenZhongXiaSongKuaiDi#WA 743ms3748kbC++141.6kb2022-07-29 15:36:112022-07-29 15:36:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-29 15:36:13]
  • 评测
  • 测评结果:WA
  • 用时:743ms
  • 内存:3748kb
  • [2022-07-29 15:36:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const double eps = 1e-6;
int T,n;
struct Pt{
	double x,y,z;
	Pt operator - (const Pt&t) const {return (Pt){x-t.x,y-t.y,z-t.z};}
	double sql(){return x*x+y*y+z*z;}
	double operator * (const Pt&t) const {return x*t.x+y*t.y+z*t.z;}
	Pt operator ^ (const double&t) const {return (Pt){x*t,y*t,z*t};}
}a[maxn][2],b[maxn];
inline bool chk(int A,int B,int C){
	Pt v1=b[B]-b[A], v2=b[C]-b[A];
	return fabs(fabs((v1*v2)*(v1*v2))-v1.sql()*v2.sql())<eps;
}
inline Pt proc(Pt A,Pt E){
	double lb = (A*E)/A.sql();
	return E - (A^lb);
}
inline bool getcrs(int A,int B,int C,int idx){
	Pt v1=b[B]-b[A], v2=b[C]-b[A];
	Pt a1 = a[idx][0]-b[A];
	Pt a2 = a[idx][1]-b[A];
/*	a1 = proc(v1,a1);
	printf("f1 %.1lf %.1lf %.1lf\n",a1.x,a1.y,a1.z);
	printf("f2 %.1lf %.1lf %.1lf\n",a2.x,a2.y,a2.z);
	printf("f3 %.1lf %.1lf %.1lf\n",v1.x,v1.y,v1.z);
	printf("f4 %.1lf %.1lf %.1lf\n",v2.x,v2.y,v2.z);
*/	a1 = proc(v1,proc(v2,a1));
	a2 = proc(v1,proc(v2,a2));
	return a1*a2 <= eps;
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d",&n);
		for(int al=1;al<=n;al++)for(int be=0;be<2;be++)
			scanf("%lf%lf%lf",&a[al][be].x,&a[al][be].y,&a[al][be].z), b[(al-1)*2+1+be]=a[al][be];
		int flg = 0, ans = 0;
		for(int al=1;al<=2*n;al++)for(int be=al+1;be<=2*n;be++)for(int ga=be+1;ga<=2*n;ga++)if(!chk(al,be,ga)){
			flg = 1; int cnt = 0;
			for(int idx=1;idx<=n;idx++)if(getcrs(al,be,ga,idx)) ++cnt;
			ans = max(ans,cnt);
		}
		printf("%d\n",flg ? ans:n);
//		printf("ft %d\n",getcrs(1,5,7,2));
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 743ms
memory: 3748kb

input:

10
50
94 57 39 12 69 59
86 46 44 17 32 83
35 86 71 47 41 50
68 93 71 54 28 25
92 74 2 30 60 86
87 52 54 32 17 88
51 63 96 23 12 69
1 82 85 20 9 90
25 72 42 49 4 52
30 86 94 93 43 34
10 45 30 85 32 75
84 37 71 37 78 19
28 30 7 40 10 77
5 68 86 83 3 41
71 73 8 86 69 48
65 11 6 49 64 50
61 2 24 60 11 9...

output:

33
38
36
35
39
36
34
31
50
50

result:

wrong answer 2nd lines differ - expected: '39', found: '38'