QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#190780#2839. 3D GeometryqzezAC ✓96ms3788kbC++141.2kb2023-09-29 14:07:262023-09-29 14:07:27

Judging History

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

  • [2023-09-29 14:07:27]
  • 评测
  • 测评结果:AC
  • 用时:96ms
  • 内存:3788kb
  • [2023-09-29 14:07:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
	if(x.empty())return out<<"[]";
	out<<'['<<x[0];
	for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
	return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
	cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
	cerr<<x<<' ',debug(y...);
}
const int N=4;
int x[4],y[4],z[4];
void init(int *a){
	if(a[0]>a[1]){
		for(int i=0;i<4;i++)a[i]=-a[i];
	}
	for(int i=1;i<4;i++)a[i]-=a[0];
	if(a[2]>a[3])swap(a[2],a[3]);
	a[2]=max(a[2],0),a[3]=max(a[3],0);
}
void get(){
	for(int i=1;i<4;i++)scanf("%d%d%d",&x[i],&y[i],&z[i]);
	init(x),init(y),init(z);
	double sum=0;
	// debug(ary(x,0,3));
	// debug(ary(y,0,3));
	// debug(ary(z,0,3));
	for(int S=0;S<8;S++){
		double t=1-1.0*x[2+(S>>0&1)]/x[1]-1.0*y[2+(S>>1&1)]/y[1]-1.0*z[2+(S>>2&1)]/z[1];
		if(t>0)sum+=(__builtin_parity(S)?-1:1)*t*t*t;
	}
	printf("%.9lf\n",max(0.0,sum)*x[1]*y[1]*z[1]/6);
}
int main(){
	for(;~scanf("%d%d%d",&x[0],&y[0],&z[0]);)get();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3788kb

input:

0 0 0
1 1 1
0 0 0
1 1 1
0 0 0
2 2 2
0 0 0
1 1 1
0 2 0
2 0 2
1 0 1
0 1 0

output:

0.166666667
0.833333333
0.166666667

result:

ok 3 numbers

Test #2:

score: 0
Accepted
time: 75ms
memory: 3716kb

input:

-3 -4 2
-5 -5 4
0 0 3
3 4 2
1 5 2
-4 0 0
5 -5 0
-2 -1 3
5 4 2
3 -5 -1
0 -2 -1
-4 -4 -3
-4 4 -2
-2 2 -1
2 2 1
4 0 5
-4 1 0
-5 -2 4
-5 2 -4
5 0 1
2 5 1
-1 0 -3
-1 5 -4
-4 2 -2
2 2 -4
1 3 -1
2 4 2
-2 1 3
2 5 2
-2 -3 -5
-1 0 0
5 4 2
2 5 3
-3 -3 -3
5 4 -4
1 2 -3
2 -4 2
-3 -2 -2
2 -2 -1
-4 -5 3
4 -3 -3
-3...

output:

0.000000000
0.000000000
0.000000000
0.000000000
0.708333333
0.000000000
0.000000000
15.355654762
0.000000000
6.562500000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
1.319444444
0.000000000
0.526748971
4.650000000...

result:

ok 100000 numbers

Test #3:

score: 0
Accepted
time: 81ms
memory: 3552kb

input:

-2 -2 -9
1 7 6
-3 -1 -4
-5 -6 2
-3 -4 -9
-10 -5 -4
0 2 -6
7 -9 2
6 4 5
-2 -6 0
8 -8 -3
-3 -10 2
10 -3 -8
-7 -5 -10
-9 -5 1
10 8 -1
7 9 10
6 3 9
-10 -10 -4
0 2 1
-2 4 9
10 5 -4
-6 6 3
7 4 8
6 5 2
3 -7 8
2 3 1
4 -10 7
-7 -3 -6
-10 5 -9
0 3 1
-5 -6 8
5 -3 8
-8 -8 -4
5 -10 4
0 3 1
9 -9 0
-8 8 -3
-7 9 -2...

output:

0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
16.255732249
0.166666667
0.000000000
26.201923077
1.449891068
0.000000000
0.000000000
0.000000000
0.000000000
1.280276817
0.000000000
0.000000000
0.000000000
13.431240412
0.000000000
0.000000000
0.000000000
0.045454545
0.000000000
18.293333...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 87ms
memory: 3720kb

input:

91 49 27
-66 89 -21
-22 35 78
-64 41 -19
93 87 -92
72 -32 -67
-48 28 -6
-50 20 78
-33 90 41
75 -51 43
89 9 -89
-35 -73 88
13 13 82
82 -40 72
-21 -75 36
15 79 -66
-21 -99 -49
-33 60 78
-27 -86 -64
61 66 96
-77 37 -71
72 -35 -9
38 86 -68
51 65 15
-16 -64 -25
-72 23 81
-20 60 60
-52 -99 19
24 83 27
-11...

output:

0.000000000
0.000000000
391.127206881
0.000000000
28313.212264151
0.000000000
11477.662564207
4368.006677006
14406.483590596
5814.427201071
0.000000000
50112.716889796
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
0.000000000
38.151407055
0.000000000
0.000000000
0.000000000...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 96ms
memory: 3716kb

input:

-67 241 62
-271 -19 -199
364 487 343
293 433 -343
346 -321 78
-119 68 -487
-319 -45 -165
465 142 491
-310 476 -388
419 409 -124
167 -448 362
233 341 -119
9 -422 290
202 321 -217
310 216 286
172 10 -220
77 107 -282
352 -438 -26
171 81 111
-192 70 -132
376 -361 246
-371 354 -77
-400 -224 457
118 -387 ...

output:

0.000000000
417528.646965722
0.000000000
0.000000000
49064.274495413
5211742.513100332
3370766.246515174
0.000000000
0.000000000
84.405133541
165311.117708427
0.000000000
0.000000000
0.000000000
52736.152560963
0.000000000
132685.480972369
0.000000000
1436397.515315554
0.000000000
0.000000000
0.0000...

result:

ok 100000 numbers