QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711664 | #5461. Paddle Star | 123456zmy | AC ✓ | 236ms | 4308kb | C++17 | 1.6kb | 2024-11-05 12:50:56 | 2024-11-05 12:51:04 |
Judging History
answer
#include<bits/stdc++.h>
#define double long double
#define pi 3.14159265358979323846
using namespace std;
struct point
{
double x,y;
point rot(double t)const{return {x*cos(t)-y*sin(t),x*sin(t)+y*cos(t)};}
double len2()const{return x*x+y*y;}
double len()const{return sqrt(len2());}
point operator*(const double t)const{return {t*x,t*y};}
point operator/(const double t)const{return {x/t,y/t};}
point operator+(const point o)const{return {x+o.x,y+o.y};}
point operator-(const point o)const{return {x-o.x,y-o.y};}
};
double det(point i,point j){return i.x*j.y-j.x*i.y;}
double dot(point i,point j){return i.x*j.x+i.y*j.y;}
struct line
{
point s,t;
};
point line_int(line a,line b)
{
double s1=det(a.t-a.s,b.s-a.s);
double s2=det(a.t-a.s,b.t-a.s);
return (b.s*s2-b.t*s1)/(s2-s1);
}
point project_to_line(point a,line b)
{
return b.s+(b.t-b.s)*(dot(a-b.s,b.t-b.s)/(b.t-b.s).len2());
}
int main()
{
int t;
cin>>t;
while(t--)
{
double la,lb,a,b;
cin>>la>>lb>>a>>b;
a*=pi/180,b*=pi/180;
if(b<=pi/2)
{
printf("%.10Lf\n",(la+lb)*(la+lb)*a+lb*lb*b);
continue;
}
double ans=(la+lb)*(la+lb)*a+lb*lb*b;
point O={0,0},A={la,0};
A=A.rot(a);
point A_={A.x,-A.y};
point P={lb,0};
P=P.rot(a+b)+A;
point Q=project_to_line(O,{P,A});
if(Q.x<P.x)Q=P;
point Q_=Q.rot(-2*a);
if(det(A,Q_)>=0)
{
ans+=det(A,Q)-Q.len2()*(acos(Q.x/Q.len())-acos(Q_.x/Q_.len()));
ans-=det(line_int({O,A},{Q_,A_}),Q_);
printf("%.10Lf\n",ans);
}
else
{
ans+=det(A,Q)-Q.len2()*(acos(Q.x/Q.len())-a);
printf("%.10Lf\n",ans);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4308kb
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: 187ms
memory: 4140kb
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: 136ms
memory: 4172kb
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: 175ms
memory: 4172kb
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: 3876kb
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: 155ms
memory: 4176kb
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: 0ms
memory: 3988kb
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: 181ms
memory: 4256kb
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: 132ms
memory: 4140kb
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: 191ms
memory: 4208kb
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: 180ms
memory: 4172kb
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: 168ms
memory: 4212kb
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: 168ms
memory: 4044kb
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: 158ms
memory: 4208kb
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: 165ms
memory: 4260kb
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: 198ms
memory: 4212kb
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: 155ms
memory: 4168kb
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: 185ms
memory: 4208kb
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: 212ms
memory: 4044kb
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:
7823031139236863639.5000000000 587759779770854597.3125000000 95369829970997625.3437500000 3895961013788279777.2500000000 443752067877684922.6875000000 1832058841745101844.2500000000 1157411971581695277.3750000000 25211463877824919.2753906250 1585510323477645079.0000000000 3564846423752922596.7500000...
result:
ok 100000 numbers
Test #20:
score: 0
Accepted
time: 236ms
memory: 4108kb
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:
1298002666918420110.1250000000 3375253522633562173.2500000000 6039368287407980396.0000000000 1313133658442171565.0000000000 835838455087290167.0000000000 715665701891950389.0625000000 3352034067230078471.5000000000 3413794084111542744.5000000000 5750292420404998077.0000000000 3039557717337095377.500...
result:
ok 100000 numbers