QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#236984#7521. Find the GapEvierWA 19ms3948kbC++14887b2023-11-04 12:14:432023-11-04 12:14:44

Judging History

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

  • [2023-11-04 12:14:44]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:3948kb
  • [2023-11-04 12:14:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define y1 y114514
int n,x[51],y[51],z[51];
ld ans=1e15;
bool flag;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i]>>y[i]>>z[i];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				ll x1=x[i],y1=y[i],z1=z[i],x2=x[j],y2=y[j],z2=z[j],x3=x[k],y3=y[k],z3=z[k];
				ll xa=x2-x1,ya=y2-y1,za=z2-z1,xb=x3-x1,yb=y3-y1,zb=z3-z1;
				ll a=ya*zb-yb*za;
				ll b=za*xb-xa*zb;
				ll c=xa*yb-ya*xb;
				if(a==0&&b==0&&c==0)continue;
				flag=1;
				ll d=a*x1+b*y1+c*z1;
				d=-d;
				ld mx=-1e15,mi=1e15;
				for(int l=1;l<=n;l++){
					ld tmp=a*x[l]+b*y[l]+c*z[l]+d;
					ld p=a*a+b*b+c*c;p=sqrt(p);
					tmp/=p;
					mx=max(mx,tmp),mi=min(mi,tmp);
				}
				ans=min(ans,mx-mi);
			}
		}
	}
	if(!flag)puts("0");
	else printf("%.12Lf",ans);
}

详细

Test #1:

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

input:

8
1 1 1
1 1 2
1 2 1
1 2 2
2 1 1
2 1 2
2 2 1
2 2 2

output:

1.000000000000

result:

ok found '1.000000000', expected '1.000000000', error '0.000000000'

Test #2:

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

input:

5
1 1 1
1 2 1
1 1 2
1 2 2
2 1 1

output:

0.707106781187

result:

ok found '0.707106781', expected '0.707106781', error '0.000000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

50
973 1799 4431
1036 1888 4509
1099 1977 4587
1162 2066 4665
1225 2155 4743
1288 2244 4821
1351 2333 4899
1414 2422 4977
1540 2600 5133
1603 2689 5211
1666 2778 5289
1729 2867 5367
1792 2956 5445
1855 3045 5523
1918 3134 5601
1981 3223 5679
2044 3312 5757
2107 3401 5835
2170 3490 5913
2296 3668 606...

output:

0

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

50
4532 3245 1339
4624 3260 1345
4716 3275 1351
4808 3290 1357
4900 3305 1363
5084 3335 1375
5176 3350 1381
5268 3365 1387
5360 3380 1393
5452 3395 1399
5544 3410 1405
5728 3440 1417
5820 3455 1423
5912 3470 1429
6096 3500 1441
6188 3515 1447
6280 3530 1453
6372 3545 1459
6464 3560 1465
6556 3575 14...

output:

0

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #5:

score: 0
Accepted
time: 18ms
memory: 3856kb

input:

50
1 70 7443
1 138 5063
2 109 5971
3 23 8874
3 152 4359
4 59 7507
5 50 7715
5 73 6910
7 25 8376
7 103 5646
8 3 9039
9 83 6132
9 142 4067
10 124 4590
11 140 3923
12 168 2836
13 46 6999
13 84 5669
13 189 1994
13 229 594
15 171 2410
16 94 4998
20 38 6530
20 125 3485
21 78 5023
22 210 296
23 117 3444
25...

output:

0.000000000000

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #6:

score: 0
Accepted
time: 18ms
memory: 3916kb

input:

50
1 95 5991
3 22 9019
25 103 5199
25 141 3603
38 103 4952
39 139 3421
59 6 8627
60 48 6844
66 33 7360
107 88 4271
109 188 33
112 177 438
114 107 3340
122 77 4448
123 169 565
127 1 7545
142 161 540
143 70 4343
146 153 800
156 129 1618
162 63 4276
162 150 622
166 93 2940
173 78 3437
180 143 574
189 1...

output:

0.000000000000

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #7:

score: -100
Wrong Answer
time: 19ms
memory: 3800kb

input:

50
14 3658 1218
17 32 7984
741 1906 5773
755 8668 1019
834 2386 4591
1306 3866 7044
2304 2895 120
2450 8613 7374
2595 1919 2119
2610 9866 9419
2694 2845 2941
2838 2702 7608
2883 4143 4049
3082 4800 3611
3338 6703 9039
3424 2035 1863
3471 2672 5858
4339 1330 2029
4720 6970 4719
4853 387 5866
5415 975...

output:

9348.213177890943

result:

wrong answer 1st numbers differ - expected: '9341.5658962', found: '9348.2131779', error = '0.0007116'