QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#796048 | #9808. Fragile Pinball | ucup-team191# | AC ✓ | 512ms | 5980kb | C++23 | 3.0kb | 2024-12-01 06:59:11 | 2024-12-01 06:59:18 |
Judging History
answer
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using pii=pair<int,int>;
using ll=long double;
using ld=long double;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)
const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;
pll add(pll a,pll b)
{
return {a.x+b.x,a.y+b.y};
}
pll sub(pll a,pll b)
{
return {a.x-b.x,a.y-b.y};
}
pll mul(ll x,pll a)
{
return {a.x*x,a.y*x};
}
ll cross(pll a,pll b)
{
return a.x*b.y-a.y*b.x;
}
ll cross(pll a,pll b,pll c)
{
return cross(sub(b,a),sub(c,a));
}
ll ccw(pll a,pll b,pll c)
{
return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y);
}
pll perp(pll a)
{
return {-a.y,a.x};
}
ll dist2(pll a)
{
return a.x*a.x+a.y*a.y;
}
pll refl(pll a,pll b,pll p)
{
pll v=sub(b,a);
return sub(p,mul(2*cross(v,sub(p,a))/dist2(v),perp(v)));
}
pair<int,pll> lineInter(pll s1,pll e1,pll s2,pll e2)
{
ll d=cross(sub(e1,s1),sub(e2,s2));
if (d==0) return {-(cross(s1,e1, s2) == 0), pair<ld,ld>(0.L,0.L)};
ll p = cross(s2,e1, e2), q = cross(s2,e2, s1);
pll uz=add(mul(p,s1),mul(q,e1));
return {1,mul(1.L/d,uz)};
}
const ld eps=1e-9;
int sgn(ll x)
{
return (x>eps)-(x<-eps);
}
bool lineSegInter(pll l1,pll l2,pll s1,pll s2)
{
return sgn(ccw(s1,l1,l2))*sgn(ccw(s2,l1,l2))<=0;
}
int n;
ld an[N];
void rek(vector<vector<pll>> polys,vi segs)
{
int sc=segs.size();
for (int i=0;i<n;++i)
{
bool im=0;
for (int j=0;j<sc;++j) if (segs[j]==i) im=1;
if (!im)
{
pll a=polys.back()[i],b=polys.back()[(i+1)%n];
vector<pll> nex;
for (auto x: polys.back()) nex.pb(refl(a,b,x));
vi nsegs=segs;
nsegs.pb(i);
vector<vector<pll>> npoly=polys;
npoly.pb(nex);
rek(npoly,nsegs);
}
}
for (int i1=0;i1<=sc;++i1) for (int i2=0;i2<n;++i2) for (int j1=0;j1<=sc;++j1) for (int j2=0;j2<n;++j2)
{
pll a=polys[i1][i2],b=polys[j1][j2];
bool ok=1;
for (int i=0;i<sc;++i) if (!lineSegInter(a,b,polys[i][segs[i]],polys[i][(segs[i]+1)%n]))
{
ok=0;
break;
}
if (ok)
{
if (sc==0)
{
//cout<<a.x<<' '<<a.y<<' '<<b.x<<' '<<b.y<<en;
}
for (int l1=0;l1<n;++l1) if (lineSegInter(a,b,polys[0][l1],polys[0][(l1+1)%n]))
{
for (int l2=0;l2<n;++l2) if (lineSegInter(a,b,polys.back()[l2],polys.back()[(l2+1)%n]))
{
auto p1=lineInter(a,b,polys[0][l1],polys[0][(l1+1)%n]);
auto p2=lineInter(a,b,polys.back()[l2],polys.back()[(l2+1)%n]);
if (p1.x==1 && p2.x==1)
{
an[segs.size()]=max(an[segs.size()],dist2(sub(p1.y,p2.y)));
}
}
}
}
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
vector<pll> poly;
for (int i=0;i<n;++i)
{
ll x,y;
cin>>x>>y;
poly.pb({x,y});
}
rek({poly},{});
cout<<fixed<<setprecision(15);
for (int i=1;i<=n;++i) an[i]=max(an[i],an[i-1]);
for (int i=0;i<=n;++i) cout<<sqrt(an[i])<<en;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3912kb
input:
3 4 0 0 3 0 -1
output:
5.000000000000000 8.000000000000000 8.868185038797563 12.210024810881956
result:
ok 4 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3960kb
input:
3 4 0 0 3 0 2
output:
5.000000000000000 5.366563145999495 6.111919138499425 6.782203304416628
result:
ok 4 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
3 4 0 0 3 0 1
output:
5.000000000000000 6.184658438426491 7.195223542744545 8.653439499294253
result:
ok 4 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
3 62 -12 -48 100 -45 -96
output:
196.022957839126588 312.041737832760560 326.278477718776178 452.807123729110785
result:
ok 4 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
3 90 99 -76 -57 99 84
output:
227.798156269975109 274.352306457763450 306.891779477092104 330.105185546433595
result:
ok 4 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
3 -67 22 -86 12 -81 -12
output:
36.769552621700471 39.563975005654036 50.916855917106008 72.277585517450639
result:
ok 4 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
3 71 -48 -81 2 -83 -44
output:
160.012499511756893 308.056794567568795 308.056794567568795 308.056794567568795
result:
ok 4 numbers
Test #8:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
3 44 -44 -31 -77 8 -98
output:
81.939001702485978 115.792668299793153 125.606044029920128 167.936493496979336
result:
ok 4 numbers
Test #9:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
3 40 91 -42 90 -5 -99
output:
195.256241897666360 378.874266791998848 378.874266791998848 378.874266791998848
result:
ok 4 numbers
Test #10:
score: 0
Accepted
time: 7ms
memory: 3916kb
input:
4 -10 -97 13 -98 90 50 42 97
output:
200.848201386021876 269.687341465334579 382.166068040496157 476.599262830396793 476.599262830396793
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 7ms
memory: 3928kb
input:
4 39 89 -72 -94 87 -58 90 36
output:
214.032707780843627 413.744146609923803 413.744146609923803 502.965718248480382 595.018212654905458
result:
ok 5 numbers
Test #12:
score: 0
Accepted
time: 3ms
memory: 3872kb
input:
4 -6 -90 33 -75 4 97 -36 -69
output:
187.267188797183582 269.549444397368684 309.208057795514970 364.701658071570066 395.378287554406087
result:
ok 5 numbers
Test #13:
score: 0
Accepted
time: 7ms
memory: 3804kb
input:
4 44 81 27 81 60 -57 83 3
output:
141.890803084625608 187.122714959936142 251.476689548054751 274.127656843484746 286.319517405730432
result:
ok 5 numbers
Test #14:
score: 0
Accepted
time: 7ms
memory: 3964kb
input:
4 96 -13 99 1 -67 -36 67 -37
output:
170.073513516949487 183.085426249045502 223.212103517245333 277.379184197401988 306.150397270400562
result:
ok 5 numbers
Test #15:
score: 0
Accepted
time: 7ms
memory: 3912kb
input:
4 -18 -98 80 -59 73 68 -78 -62
output:
199.251097863976649 378.325878824374495 378.325878824374495 512.617543811857620 557.387457615910203
result:
ok 5 numbers
Test #16:
score: 0
Accepted
time: 51ms
memory: 3916kb
input:
5 -90 41 -93 27 94 79 83 91 -44 94
output:
194.095337398918473 206.355524454424886 256.731302000890899 337.346903462340383 377.929160408347815 396.662938660598424
result:
ok 6 numbers
Test #17:
score: 0
Accepted
time: 54ms
memory: 3900kb
input:
5 78 -95 96 29 -95 34 -76 -82 64 -95
output:
215.800834104041405 379.474351826664981 555.074789479486291 584.007527316151920 640.709438394289463 693.172491602915701
result:
ok 6 numbers
Test #18:
score: 0
Accepted
time: 55ms
memory: 3892kb
input:
5 45 -26 38 62 -31 57 -40 -43 -13 -91
output:
161.276160668587346 297.827772991761006 329.103532279919254 455.419819785876916 496.858777460312447 600.672113063065656
result:
ok 6 numbers
Test #19:
score: 0
Accepted
time: 44ms
memory: 3900kb
input:
5 -28 78 -63 63 -85 30 -7 -80 61 -77
output:
187.018715640975355 342.371973695578297 437.283084003414151 525.978277968785098 704.064453641557651 704.064453641557651
result:
ok 6 numbers
Test #20:
score: 0
Accepted
time: 51ms
memory: 3920kb
input:
5 -20 91 -21 90 4 -99 18 -92 41 57
output:
191.509790872425110 232.385525097110173 282.236079299193015 389.306701189258031 404.075195946429088 477.051235797513698
result:
ok 6 numbers
Test #21:
score: 0
Accepted
time: 51ms
memory: 3900kb
input:
5 40 -91 65 75 -50 -86 -48 -87 27 -96
output:
197.853481141980416 296.422933351981557 328.653687667102951 385.630036256522266 404.176017044455335 404.176017044455335
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 504ms
memory: 3852kb
input:
6 86 57 51 69 2 -52 18 -100 89 -84 87 33
output:
172.191753577225643 341.135135135135135 400.666074746634878 501.268188074796617 565.608985155262017 622.690844361705761 665.700571573284788
result:
ok 7 numbers
Test #23:
score: 0
Accepted
time: 503ms
memory: 3840kb
input:
6 99 49 88 89 55 54 23 -38 18 -72 84 -63
output:
175.559106855782335 264.079024002672979 313.656233652890279 390.454592258693888 470.752012302535775 521.830923400922023 550.768827220738864
result:
ok 7 numbers
Test #24:
score: 0
Accepted
time: 505ms
memory: 3976kb
input:
6 53 36 -5 100 -56 98 -79 14 -84 -24 73 -27
output:
179.627392120466972 314.862786031766896 385.343658453594715 493.193630414759450 606.181473809271698 673.308818766480549 673.308818766480549
result:
ok 7 numbers
Test #25:
score: 0
Accepted
time: 498ms
memory: 3844kb
input:
6 76 84 32 100 77 -80 91 -17 95 37 86 79
output:
185.539753152794725 211.907327945102660 264.716755227009071 315.062400900960846 324.874605299655238 356.526327351884816 356.526327351884816
result:
ok 7 numbers
Test #26:
score: 0
Accepted
time: 505ms
memory: 3976kb
input:
6 -35 12 -31 -22 -6 -81 96 -21 69 64 -29 65
output:
163.248277173145077 291.515435867978080 399.010163643813787 496.206291028979169 585.323790738471250 681.215883571867488 681.215883571867488
result:
ok 7 numbers
Test #27:
score: 0
Accepted
time: 506ms
memory: 3928kb
input:
6 89 -75 97 1 8 95 -21 87 -23 -98 75 -87
output:
198.725941940150330 382.902721418514523 570.267308822347721 699.344145373210662 793.027042319521290 950.401188846336391 950.401188846336391
result:
ok 7 numbers
Test #28:
score: 0
Accepted
time: 508ms
memory: 3860kb
input:
6 -69 88 -100 50 -100 -50 28 -25 70 26 65 90
output:
216.390850083824016 349.424957195291763 517.364845535935150 604.950699399471889 740.926805766347742 867.573761534729373 994.176063711636781
result:
ok 7 numbers
Test #29:
score: 0
Accepted
time: 503ms
memory: 3924kb
input:
6 55 99 -32 6 -38 -60 89 -99 97 -98 81 73
output:
201.427406278291733 379.481415523892919 457.672576389815423 590.726077870105609 652.191527379413946 771.740899290467342 888.951291572580380
result:
ok 7 numbers
Test #30:
score: 0
Accepted
time: 508ms
memory: 3852kb
input:
6 -64 25 -59 -69 23 -94 73 -88 98 20 92 89
output:
218.552053296234213 371.496824368326204 490.995916107724363 639.683072892486636 746.655933290614715 869.842554905856347 875.951296285140102
result:
ok 7 numbers
Test #31:
score: 0
Accepted
time: 504ms
memory: 3856kb
input:
6 -62 -66 78 -48 99 89 73 94 -91 73 -89 -60
output:
239.885389300807564 382.621584748225249 560.830410535877448 628.056180305478774 749.571049616148085 842.648330995755417 933.084333761491333
result:
ok 7 numbers
Test #32:
score: 0
Accepted
time: 512ms
memory: 3980kb
input:
6 91 49 68 88 -51 98 -95 35 -21 -72 92 -31
output:
198.305320150519411 382.202915459764795 500.539066260418219 668.390333866517069 835.277970341260956 965.787016375946148 1130.006060320628316
result:
ok 7 numbers
Test #33:
score: 0
Accepted
time: 503ms
memory: 3912kb
input:
6 -49 -75 88 10 76 64 -97 46 -75 -62 -72 -67
output:
197.648678214654398 371.898218573907400 549.691700439943180 696.682966717666939 739.764248129336020 784.403044133067559 784.403044133067559
result:
ok 7 numbers
Test #34:
score: 0
Accepted
time: 503ms
memory: 3852kb
input:
6 -100 90 -25 -88 85 -85 97 31 83 99 22 100
output:
254.656631564936867 407.460694453042411 579.314642709575580 748.450978058450638 833.000173773527243 949.747074756197757 1042.029416989733808
result:
ok 7 numbers
Test #35:
score: 0
Accepted
time: 504ms
memory: 3892kb
input:
6 -61 98 -93 70 -98 34 -74 -94 94 -87 95 36
output:
244.167974968053499 482.589805480785411 586.628720030649442 765.081070551088939 925.800448168068361 1083.663061989393907 1146.063506475412568
result:
ok 7 numbers
Test #36:
score: 0
Accepted
time: 490ms
memory: 3848kb
input:
6 -86 -4 -39 -8 -6 -9 39 -6 25 8 -64 7
output:
125.015998976131051 127.427807997103719 142.203492675366987 158.035490388818071 158.035490388818071 158.171401604881801 168.584662376118731
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 52ms
memory: 3920kb
input:
5 69 -12 69 13 -24 17 -93 -2 -55 -14
output:
162.692962355474983 324.000000000000000 324.000000000000000 329.038865650544703 329.038865650544703 331.999189196290000
result:
ok 6 numbers
Test #38:
score: 0
Accepted
time: 52ms
memory: 3904kb
input:
5 26 46 -20 38 -23 22 -16 -75 24 -30
output:
128.082004981183832 203.821452147112316 251.133813177128841 288.823087576475459 341.563191710891582 389.090671752486473
result:
ok 6 numbers
Test #39:
score: 0
Accepted
time: 500ms
memory: 3852kb
input:
6 -58 -21 -46 -25 7 -25 45 -21 47 25 -82 17
output:
132.563192478153603 257.061493267184451 282.815329161784540 340.924108711198257 415.734467087733718 415.734467087733718 415.734467087733718
result:
ok 7 numbers
Test #40:
score: 0
Accepted
time: 503ms
memory: 3940kb
input:
6 19 -61 36 -24 17 76 0 93 -31 52 -3 -93
output:
186.024191975129944 203.195561326480732 354.195907380626132 369.555485806916309 396.635303666843960 500.349135682338252 500.349135682338252
result:
ok 7 numbers
Test #41:
score: 0
Accepted
time: 505ms
memory: 5952kb
input:
6 33 -70 44 32 -31 68 -35 25 -31 -50 8 -63
output:
152.118374958451354 228.854975912694544 330.282346641011050 431.925596947997424 439.741714577879501 527.333138423538638 546.341421819224552
result:
ok 7 numbers
Test #42:
score: 0
Accepted
time: 504ms
memory: 3876kb
input:
6 10 94 -35 45 -23 -79 31 -51 37 -40 36 20
output:
176.119277763679238 244.082264160134512 326.065363137960143 427.776825379810997 478.048055532320483 550.232577212896163 559.581247728870543
result:
ok 7 numbers
Test #43:
score: 0
Accepted
time: 504ms
memory: 3908kb
input:
6 63 -31 42 46 -79 -26 -67 -31 -10 -52 8 -52
output:
142.088000900850174 271.361751173594839 284.291086170634113 342.056618446413720 427.942088219205640 428.739918264754628 428.739918264754628
result:
ok 7 numbers
Test #44:
score: 0
Accepted
time: 506ms
memory: 3896kb
input:
6 4 58 -5 -64 88 -16 93 1 67 41 16 59
output:
127.314571043537668 245.954067006266593 306.915430542796755 382.595057864384842 469.278641208368548 473.926991444092300 473.926991444092300
result:
ok 7 numbers
Test #45:
score: 0
Accepted
time: 496ms
memory: 3904kb
input:
6 -30 -90 7 -96 47 -35 56 -12 43 68 33 80
output:
181.298097066681866 355.784828411940409 357.571241396227704 373.868815757984235 502.972150764275924 502.972150764275924 502.972150764275924
result:
ok 7 numbers
Test #46:
score: 0
Accepted
time: 508ms
memory: 3884kb
input:
6 -34 72 -47 -49 -43 -51 23 -73 95 -13 44 69
output:
155.801155323059142 295.765192644989699 422.425052480404360 529.529010619029536 660.528238394411956 761.686572300104339 886.232239093677606
result:
ok 7 numbers
Test #47:
score: 0
Accepted
time: 501ms
memory: 3904kb
input:
6 87 16 60 72 -64 -64 -3 -99 30 -94 48 -82
output:
184.043473125237451 359.345786475904364 406.697511106830885 521.115561033513814 629.683616598327913 629.683616598327913 629.683616598327913
result:
ok 7 numbers
Test #48:
score: 0
Accepted
time: 509ms
memory: 3912kb
input:
6 82 10 30 91 -49 73 -41 -85 57 -77 80 -22
output:
189.781453256107194 339.863431198409204 507.004697726373498 598.804219118381023 691.792748251315465 736.135162510376508 745.792273615026685
result:
ok 7 numbers
Test #49:
score: 0
Accepted
time: 501ms
memory: 3840kb
input:
6 10 -88 92 -12 94 -3 70 69 -94 -20 -22 -87
output:
188.767052209859971 367.456664111565678 489.911829666937611 545.447218447667264 667.490580459397473 669.724521187284218 679.242678289316649
result:
ok 7 numbers
Test #50:
score: 0
Accepted
time: 495ms
memory: 3904kb
input:
6 -5 82 -9 14 3 -92 6 -73 9 5 -1 98
output:
190.042100598788373 190.626191347323012 191.093643760278956 191.093643760278956 191.093643760278956 191.093643760278956 191.093643760278956
result:
ok 7 numbers
Test #51:
score: 0
Accepted
time: 493ms
memory: 3904kb
input:
6 3 98 -19 16 -2 -99 7 -92 19 21 14 68
output:
197.063441561340849 200.897092782856550 214.550260357802837 235.204733013323202 235.204733013323202 251.755832368839664 251.755832368839664
result:
ok 7 numbers
Test #52:
score: 0
Accepted
time: 498ms
memory: 3840kb
input:
6 17 80 11 92 -22 66 -23 -63 -5 -98 27 41
output:
190.672494083441411 214.543315675785365 292.333949074323760 355.378463813608024 379.549512997398332 405.501437501944820 405.501437501944820
result:
ok 7 numbers
Test #53:
score: 0
Accepted
time: 501ms
memory: 3856kb
input:
6 28 25 -6 97 -29 14 -29 -14 3 -99 29 16
output:
196.206523846685587 206.108484340342406 215.865811286592190 264.438671935109545 318.852428692513982 379.044235768146528 420.579935062777931
result:
ok 7 numbers
Test #54:
score: 0
Accepted
time: 499ms
memory: 3888kb
input:
6 4 99 -26 75 -15 -92 31 -60 31 61 12 95
output:
191.942699783034207 241.174735699952486 385.763720416335766 417.323187295847550 481.022951189609103 551.685880915145375 551.685880915145375
result:
ok 7 numbers
Test #55:
score: 0
Accepted
time: 503ms
memory: 3908kb
input:
6 -11 -97 47 -28 39 60 -49 11 -49 -16 -19 -91
output:
164.769536019253268 223.818775976719023 314.977008184641492 425.351525168055544 459.186550661097131 555.289044411368772 555.289044411368772
result:
ok 7 numbers
Test #56:
score: 0
Accepted
time: 502ms
memory: 3940kb
input:
6 18 93 -6 99 -14 -95 -5 -99 33 -74 49 0
output:
198.002525236422174 285.155350791276694 416.661683304230050 490.473347372161090 615.656789873591268 653.344724694352458 653.344724694352458
result:
ok 7 numbers
Test #57:
score: 0
Accepted
time: 502ms
memory: 5980kb
input:
6 -24 58 -52 51 -79 -36 -53 -50 91 -24 96 -16
output:
176.139149538085371 322.416479289034883 409.003632133454122 517.485721542874388 626.301040753846485 651.420569751711319 697.645865463995717
result:
ok 7 numbers
Test #58:
score: 0
Accepted
time: 508ms
memory: 3908kb
input:
6 11 69 -25 67 -91 -28 -4 -69 99 6 59 56
output:
193.018133863116602 318.007206725259467 446.787216830640323 583.437025700868064 669.450359328444558 787.321218720367933 801.955099265269332
result:
ok 7 numbers
Test #59:
score: 0
Accepted
time: 504ms
memory: 3940kb
input:
6 -52 59 -62 54 -99 6 -91 -28 -18 -68 68 50
output:
177.101665717745298 335.053053838958708 390.147403067349245 483.122664948594219 629.101481593095823 651.340287750049682 651.340287750049682
result:
ok 7 numbers
Test #60:
score: 0
Accepted
time: 505ms
memory: 3904kb
input:
6 8 -79 72 -55 94 -27 -55 66 -77 -50 -44 -71
output:
175.641680702502958 349.237673628416000 388.544522175244610 504.040704430608489 661.861823034337243 661.861823034337243 661.861823034337243
result:
ok 7 numbers
Test #61:
score: 0
Accepted
time: 500ms
memory: 3860kb
input:
6 -14 98 -38 -90 -36 -91 -33 -92 89 -5 73 57
output:
190.947636801296915 371.885120810014920 546.271726739218390 726.773310896570844 726.773310896570844 810.810256778867036 821.837696313112706
result:
ok 7 numbers
Test #62:
score: 0
Accepted
time: 502ms
memory: 3948kb
input:
6 -85 32 -75 -54 22 -96 47 -85 87 -22 89 -5
output:
180.277563773199465 348.298087205093965 513.866351180346255 525.734650937946807 698.981654375487899 698.981654375487899 698.981654375487899
result:
ok 7 numbers
Test #63:
score: 0
Accepted
time: 511ms
memory: 3852kb
input:
6 94 -32 99 7 63 77 -94 33 -46 -88 68 -72
output:
198.919581740963853 388.113303164616164 531.424598932402600 694.419504712435877 777.104529360873239 902.649975060520670 953.135759357322036
result:
ok 7 numbers
Extra Test:
score: 0
Extra Test Passed