QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#119089#5461. Paddle StarxaphoenixAC ✓407ms3752kbC++172.1kb2023-07-04 21:37:032023-07-04 21:37:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-04 21:37:06]
  • 评测
  • 测评结果:AC
  • 用时:407ms
  • 内存:3752kb
  • [2023-07-04 21:37:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define LC k<<1
#define RC k<<1|1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,n) for (int i = a; i < n; i++)
#define repn(i,a,n) for (int i = a; i <= n; i++)
#define per(i,a,n) for (int i = n - 1; i >= a; i--)
#define pern(i,a,n) for (int i = n; i >= a; i--)
 
typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef long double LD;
 
const int N = 210;
const int M = 1100000;
const int mod = 998244353;
const int inf = (int)1e9;
const long long INF = (long long)1e18;
const double eps = 1e-15, pi = acos(-1.0);

#define double LD
inline int dcmp(double x) {
    return (x > eps) - (x < -eps);
}

double x, y, a, b;

double hs (double a, double b, double c) {
	double p = (a + b + c) / 2;
	return sqrt(p * (p - a) * (p - b) * (p - c));
}
double cs (double r, double th) {
	return th * r * r / 2;
}
double cosa (double x, double y, double z) {
	return acos((x * x + y * y - z * z) / (2 * x * y));
}

void solve() {
	cin >> y >> x >> a >> b;
	a = a * pi / 180; b = b * pi / 180;
	double z = sqrt(x * x + y * y - 2 * x * y * cos(pi - b));
	double s = hs(x, y, z);
	double h = 2 * s / x, res;
	if (dcmp(b - pi / 2) <= 0) res = 0;
	else {
		double x1, r, th, th2;
		if (dcmp(x * x + z * z - y * y) >= 0) {
			r = h; x1 = y * cos(pi - b); 
			th = b - pi / 2; th2 = pi / 2;
		}
		else {
			r = z; x1 = x; 
			th = cosa(z, y, x); th2 = cosa(x, z, y);
		}
		if (dcmp(th - 2 * a) > 0) {
			double t1 = th - 2 * a, t2 = th2, t3 = pi - t1 - t2;
			double l3 = r, l2 = l3 * sin(t2) / sin(t3), l1 = l3 * sin(t1) / sin(t3);
			res = hs(x1, r, y) - cs(r, 2 * a) - hs(l1, l2, l3);
		}
		else {
			res = hs(x1, r, y) - cs(r, th);
		}
	}
	double ans = 2 * (cs(x + y, a) + cs(x, b) + res);
	cout << fixed << setprecision(10) << ans << "\n"; 
}

int main() {
	int T;
	cin >> T;
	repn(i, 1, T) solve(); 
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
2 1 20 20
3 3 0 0
20 20 90 120
20 10 50 170
100 10 1 93

output:

3.4906585040
0.0000000000
3367.1576119065
1098.8632789841
373.9604895701

result:

ok 5 numbers

Test #2:

score: 0
Accepted
time: 342ms
memory: 3596kb

input:

100000
88 12 24 116
79 15 84 150
96 52 31 141
100 100 81 29
83 29 71 99
95 92 5 87
99 97 39 72
79 72 20 65
67 39 60 116
100 89 1 62
78 77 63 45
62 34 83 178
92 49 24 103
94 73 66 49
20 14 24 51
100 97 66 109
94 94 86 82
82 79 49 67
76 38 88 118
92 79 58 112
93 23 40 167
87 34 13 25
96 18 73 15
94 38...

output:

4526.9916132029
13636.4792654743
19433.1705026127
61610.1225953998
17006.2337269873
15903.6670369751
37972.6398434501
13840.1119024646
14968.8045203183
9194.7959252341
31073.4929366566
16982.1207432264
12675.9304201947
36683.2429519542
658.6872597027
62718.1972157592
65696.5666928493
29465.974882399...

result:

ok 100000 numbers

Test #3:

score: 0
Accepted
time: 228ms
memory: 3596kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0.0000000000
0.0174532925
0.0349065850
0.0523598776
0.0698131701
0.0872664626
0.1047197551
0.1221730476
0.1396263402
0.1570796327
0.1745329252
0.1919862177
0.2094395102
0.2268928028
0.2443460953
0.2617993878
0.2792526803
0.2967059728
0.3141592654
0.3316125579
0.3490658504
0.3665191429
0.3839724354
0...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 267ms
memory: 3576kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0.0000000000
0.0174532925
0.0349065850
0.0523598776
0.0698131701
0.0872664626
0.1047197551
0.1221730476
0.1396263402
0.1570796327
0.1745329252
0.1919862177
0.2094395102
0.2268928028
0.2443460953
0.2617993878
0.2792526803
0.2967059728
0.3141592654
0.3316125579
0.3490658504
0.3665191429
0.3839724354
0...

result:

ok 100000 numbers

Test #5:

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

input:

1
1 1 0 0

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #6:

score: 0
Accepted
time: 216ms
memory: 3596kb

input:

100000
2 1 24 89
3 1 76 68
2 2 52 144
3 3 4 2
2 2 86 44
3 2 87 123
3 2 2 53
3 1 50 172
3 3 86 156
2 2 46 1
3 3 74 71
2 2 20 104
2 2 29 86
3 3 2 30
2 2 26 178
3 2 14 108
3 3 90 69
3 2 13 175
3 3 52 35
2 2 73 31
3 3 77 105
3 1 86 143
3 3 50 109
3 1 13 94
3 2 41 139
2 2 51 154
2 1 57 40
3 3 27 112
2 2 ...

output:

5.3232542186
22.4100275956
25.1738766201
2.8274333882
27.0875099910
47.0128860698
4.5727626402
17.1015256593
80.1688642414
12.9154364648
57.6482251934
12.8643846364
14.1022603561
5.9690260418
19.8188656721
13.7360708610
67.3871624195
18.2334376566
38.1703507411
22.5496539358
64.9255289092
26.9271291...

result:

ok 100000 numbers

Test #7:

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

input:

1
1 1 1 1

output:

0.0872664626

result:

ok found '0.0872665', expected '0.0872665', error '0.0000000'

Test #8:

score: 0
Accepted
time: 271ms
memory: 3576kb

input:

100000
71 6 33 34
98 20 79 171
88 16 59 8
45 21 36 79
88 61 44 149
55 47 72 86
81 8 85 122
68 2 35 71
98 91 79 49
73 19 68 148
69 66 81 22
99 94 87 130
65 53 43 53
97 89 84 1
93 88 77 6
83 46 2 51
83 69 46 95
91 55 17 137
93 84 1 54
61 45 74 15
77 65 0 21
84 71 6 32
87 81 37 76
91 55 32 154
73 34 76...

output:

3436.2216846190
20453.8997142210
11173.4582449275
3345.0107779097
27858.1254430274
16389.7237803630
11913.3689208264
2998.1964022459
56334.4809588115
11128.1167240823
27437.5706790245
77419.2591702800
13048.2385675423
50858.6326037270
44838.5731345780
2464.3699972310
26444.6360922972
14434.015080374...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 244ms
memory: 3684kb

input:

100000
10 1 40 160
6 6 27 16
10 10 7 41
4 1 38 161
7 6 66 143
6 4 26 127
8 4 47 99
4 4 49 121
5 2 68 122
8 8 27 178
10 8 73 125
6 2 20 175
10 1 34 13
7 4 66 102
10 10 14 179
9 7 64 120
7 5 47 169
10 8 68 90
8 2 37 3
5 5 10 164
4 2 26 62
7 5 43 40
1 1 35 103
10 7 71 102
6 1 90 63
6 4 49 44
6 3 84 123...

output:

87.5849133579
77.9114978090
120.4277183876
19.6909239887
291.6581829250
83.3184895803
145.8513632372
89.2261953793
67.6719994426
321.5712287284
558.4265731546
34.9039348265
72.0297382298
168.0119006372
411.8275152924
391.8455078997
196.2804721879
485.0619057143
64.7866218340
92.3584692325
20.6646983...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 320ms
memory: 3648kb

input:

100000
8 8 89 18
10 1 17 44
6 1 43 5
11 10 84 74
11 11 64 172
10 7 85 51
7 6 71 176
9 7 51 99
5 3 12 54
6 5 26 32
3 2 21 23
10 10 59 151
9 9 81 45
7 4 2 37
11 6 3 172
11 10 65 98
11 10 78 173
7 2 9 104
10 9 46 77
8 3 24 100
11 9 77 41
10 10 55 30
11 6 37 75
9 7 25 56
10 9 14 7
9 9 12 179
11 9 6 130
...

output:

417.7620097574
36.6693675844
36.8613538021
775.6941327564
917.1929866143
472.3559087597
322.4645901228
312.6392121697
21.8864288200
68.8706922837
10.7686814848
692.8212327322
521.6614601286
14.5560459616
127.7263969814
671.4494073483
913.4668883144
20.2138463713
398.6855610331
66.5036820653
595.5237...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 250ms
memory: 3680kb

input:

100000
7 3 55 160
4 3 14 72
9 7 4 52
9 9 31 71
12 1 87 116
9 7 10 154
12 10 20 100
6 5 61 69
12 12 55 130
12 11 7 163
4 3 43 178
11 11 42 155
12 1 20 1
5 3 72 151
7 2 74 136
10 10 66 76
11 11 84 176
8 6 59 110
12 2 54 47
12 12 38 28
12 12 38 105
12 12 60 173
12 4 48 76
2 1 71 31
3 1 21 123
12 7 83 2...

output:

123.8481688417
23.2826922216
62.3431608812
275.6747553525
258.9925308538
187.4182443373
343.7313507612
158.9296816866
891.5581093363
425.5736015515
65.0474040238
703.9554219390
59.0095820099
107.1528554271
115.7908511816
593.4119456781
1088.8025991771
271.7872108174
188.0068670248
452.3893421169
646...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 200ms
memory: 3572kb

input:

100000
12 8 12 17
7 1 3 24
13 13 40 16
9 9 77 68
11 1 2 137
8 5 43 153
11 10 60 93
9 4 54 124
13 11 90 62
13 11 23 10
9 5 65 152
13 10 81 159
9 5 0 100
2 1 8 10
13 4 29 108
11 9 33 62
1 1 7 0
7 6 9 117
10 7 79 17
6 3 44 136
9 1 89 169
12 12 90 59
11 11 67 48
8 2 50 165
12 3 36 39
11 2 46 157
12 7 57...

output:

102.7649863574
3.7699111843
519.1307327132
531.5574769874
7.8958552512
201.6594478137
624.1355207458
197.8859939115
1035.7132847185
252.3397032533
297.2487707899
1051.6114311879
43.6332312999
1.4311699866
178.0801014882
318.0338962984
0.4886921906
101.4983431688
413.0147141919
86.5755164858
158.4706...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 359ms
memory: 3624kb

input:

100000
16 6 41 45
19 4 51 119
1 1 20 49
20 20 68 30
20 20 56 133
16 6 69 27
13 12 17 12
11 6 33 146
12 9 51 156
7 7 6 125
20 17 76 123
20 13 14 80
20 20 50 160
10 9 89 177
13 4 0 61
18 4 65 36
10 5 34 167
17 15 73 74
18 1 26 107
17 8 6 65
10 5 14 130
19 6 51 73
11 1 75 177
14 3 76 96
8 3 31 9
7 5 13...

output:

374.6174706481
509.2284554272
2.2514747351
2108.3577364092
2531.2743370122
599.8347573254
215.6005224989
270.9268661372
635.7110655017
129.6061759140
2456.9872192211
502.0614126287
2584.6655180164
815.1520058325
17.0344134995
559.1336791689
211.6815884571
1595.2658429079
165.9307956533
138.055543832...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 313ms
memory: 3600kb

input:

100000
21 19 6 6
17 6 48 147
16 10 56 89
18 18 89 19
19 18 79 85
15 7 12 18
20 18 57 117
17 16 36 117
9 6 12 81
20 19 4 76
19 18 7 97
21 2 79 160
21 19 5 4
21 19 25 119
14 10 54 129
21 17 49 21
21 13 48 179
14 14 31 80
18 17 51 1
8 4 37 1
13 9 90 118
14 14 47 64
16 11 3 74
20 15 30 42
19 19 38 133
1...

output:

205.3554397897
550.0648678780
816.0461450625
2120.5750411731
2368.2547153236
116.7625269584
2110.3231779301
1215.7841712539
98.0176907920
585.0343652685
715.9944571208
741.8350733032
164.8288945583
1464.1555389874
783.2976070290
1340.8491978446
1499.3758820076
697.8524481174
1095.4384517217
93.27039...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 273ms
memory: 3708kb

input:

100000
14 12 55 44
19 19 55 175
18 18 25 53
18 12 61 16
22 19 85 30
21 17 53 122
22 22 80 110
20 17 46 87
19 11 64 165
5 1 20 110
19 6 46 176
22 22 45 164
22 18 77 35
22 4 69 53
17 2 34 93
22 17 33 179
16 12 79 106
17 17 64 87
22 16 60 76
12 4 43 109
18 10 51 174
11 8 60 26
19 17 5 46
14 12 75 101
2...

output:

759.4974772979
2516.0276064942
865.1946167986
998.3981453108
2682.8328597031
1972.1516298802
3638.7491158929
1537.9317769798
1382.2181528800
14.6898172090
614.8675823021
2986.6507444780
2348.1659756332
828.8917683571
220.7281428869
1783.9488861412
1349.1665831826
1730.0925276244
1851.7245231959
224....

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 297ms
memory: 3684kb

input:

100000
22 20 49 129
22 1 9 42
29 27 41 134
29 29 72 80
27 16 71 123
28 7 21 71
25 13 70 133
28 11 27 60
29 28 68 3
23 5 1 168
27 22 79 16
29 10 17 81
27 15 90 119
29 28 86 79
22 21 69 122
27 27 49 139
16 8 11 97
16 11 4 58
12 11 32 128
18 8 35 146
29 22 27 19
30 15 50 115
15 2 24 72
18 6 80 158
13 6...

output:

2446.9221491554
83.8281639733
4035.0701226749
5401.5845954122
2878.4814120381
509.7059547524
2207.4158578307
843.4652676113
3897.0409670230
91.3684402917
3445.6813691648
592.6614540997
3265.0553099501
5957.6814016826
3188.8309213006
4354.9676823937
219.0883237022
173.3810078931
576.3227095244
600.60...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 300ms
memory: 3644kb

input:

100000
39 35 57 118
18 2 33 138
37 28 62 114
40 2 11 130
11 9 78 113
23 17 47 122
29 7 65 143
36 27 11 77
24 19 77 38
34 30 5 12
12 2 74 14
38 31 37 82
36 34 15 85
39 27 17 161
37 15 46 80
40 14 33 54
37 30 88 95
40 22 9 111
36 36 12 52
40 40 48 151
40 39 41 163
21 16 42 73
18 2 64 146
40 37 84 152
...

output:

8021.6129252429
241.9100912874
6161.9004642895
349.6471069489
706.6558630426
1953.1039104538
1613.9959824690
1741.6989671502
2724.3018827305
545.9389900238
254.1199390904
4449.8740075922
2997.7775232255
3534.1587471804
2485.0696021596
1864.2210806402
8387.1674435733
1565.5957228019
2261.9467105847
9...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 278ms
memory: 3596kb

input:

100000
9 8 74 2
47 41 64 61
42 1 75 10
33 29 33 75
43 1 76 103
48 12 73 90
50 50 35 160
50 48 13 179
49 46 77 169
30 18 74 55
44 43 77 164
15 2 31 91
49 43 31 120
49 36 39 131
43 8 23 142
33 31 25 74
25 6 58 129
28 20 31 95
8 7 1 148
37 10 52 156
11 5 54 52
49 26 33 2
20 17 13 33
38 23 89 34
50 7 60...

output:

375.4901352741
10439.8090938517
2420.5098731283
3314.8514884353
2570.0101069111
4812.9199452996
13536.1656096110
9417.1108767373
18693.8565477547
3286.7342341856
15787.4617963132
162.7174448338
8548.7942509624
8091.2507086034
1231.6104293582
3028.3905983054
1068.3169861962
1909.9819629417
131.987563...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 342ms
memory: 3568kb

input:

100000
985040437 963837006 74 178
562320397 456498961 21 57
616458849 43215539 12 112
967049313 962181597 55 20
404875500 323494205 16 148
822013814 350801410 65 117
493753261 325808227 72 151
883524417 55981080 1 165
756475575 306464991 75 65
982861539 971158777 53 2
977914232 494619050 34 80
92912...

output:

7823031139236863420.5000000000
587759779770854584.3125000000
95369829970997623.2656250000
3895961013788279691.0000000000
443752067877684913.7812500000
1832058841745101812.1250000000
1157411971581695252.2500000000
25211463877824922.3847656250
1585510323477645043.8750000000
3564846423752922517.7500000...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 407ms
memory: 3620kb

input:

100000
915624482 436335283 31 93
966989692 899762255 14 172
971565321 859650888 86 78
840892426 595383046 16 116
992919354 525701445 9 98
924698821 417910701 18 49
923077550 641792877 68 62
918753914 850646822 29 137
935549247 897719522 87 46
937380829 805246200 55 11
434960395 174040501 0 56
902102...

output:

1298002666918420132.7500000000
3375253522633562072.7500000000
6039368287407980263.0000000000
1313133658442171580.5000000000
835838455087290209.3750000000
715665701891950373.2500000000
3352034067230078397.5000000000
3413794084111542711.5000000000
5750292420404997950.0000000000
3039557717337095310.250...

result:

ok 100000 numbers