QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#668293 | #7727. Linear Gradient | ucup-team173# | AC ✓ | 1ms | 3976kb | C++20 | 1.5kb | 2024-10-23 13:23:05 | 2024-10-23 13:23:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
void solve() {
db x1,x2,y1,y2,y3,y4;
db rl,rr,gl,gr,bl,br;
cin>>x1>>y1>>y2>>rl>>gl>>bl;
cin>>x2>>y3>>y4>>rr>>gr>>br;
auto calc=[&](db rl,db rr,db gl,db gr,db bl,db br){
db l,r;
l=0,r=1;
if(rr==rl){
if(rl>=150);
else r=min(r,-1.);
}
else{
if(rr>rl)l=max(l,(150-rl)/(rr-rl));
else r=min(r,(150-rl)/(rr-rl));
}
if(gr==gl){
if(gr<=75);
else r=min(r,-1.);
}
else{
if(gr>gl)r=min(r,(75-gl)/(gr-gl));
else l=max(l,(75-gl)/(gr-gl));
}
if(br==bl){
if(br<=75);
else r=min(r,-1.);
}
else{
if(br>bl)r=min(r,(75-bl)/(br-bl));
else l=max(l,(75-bl)/(br-bl));
}
if(r<=l)return 0.;
db L=l*(y4-y3)+(1-l)*(y2-y1);
db R=r*(y4-y3)+(1-r)*(y2-y1);
db h=(x2-x1)*(r-l);
return (L+R)*h/2;
};
cout<<fixed<<setprecision(20)<<calc(rl,rr,gl,gr,bl,br)<<"\n";
cout<<fixed<<setprecision(20)<<calc(gl,gr,rl,rr,bl,br)<<"\n";
cout<<fixed<<setprecision(20)<<calc(bl,br,rl,rr,gl,gr)<<"\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3968kb
input:
0 0 50 255 0 0 100 0 100 0 255 0
output:
1686.85121107266445505957 2724.91349480968847274198 0.00000000000000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
2060 62118 92121 239 136 80 61328 12685 18891 50 69 122
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
85238 49611 95092 67 6 208 85360 45143 87657 104 126 133
output:
0.00000000000000000000 0.00000000000000000000 1191253.98392987577244639397
result:
ok 3 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
57680 36610 53516 78 65 31 81738 82352 90031 77 79 44
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3824kb
input:
91940 22309 99142 30 143 62 95387 37573 91801 180 71 34
output:
10504908.04166667163372039795 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
68239 45093 91137 51 183 30 86340 11944 39045 0 208 122
output:
0.00000000000000000000 366644421.62364137172698974609 0.00000000000000000000
result:
ok 3 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
5408 36608 48052 206 29 193 65865 29822 78504 214 12 2
output:
960445272.36301088333129882812 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
16857 976 61590 203 5 58 59842 72203 74899 167 139 204
output:
286502399.56112778186798095703 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
65363 17442 63076 12 67 206 83708 28211 29809 182 150 123
output:
0.00000000000000000000 0.00000000000000000000 76937220.39192916452884674072
result:
ok 3 numbers
Test #10:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
73730 85011 89704 19 244 78 84775 10494 71515 178 172 90
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #11:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
15380 43193 80471 79 12 138 34588 55347 86722 56 24 213
output:
0.00000000000000000000 0.00000000000000000000 536530146.94139885902404785156
result:
ok 3 numbers
Test #12:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
50 100 300 75 75 150 1000 0 10 75 75 150
output:
0.00000000000000000000 0.00000000000000000000 99750.00000000000000000000
result:
ok 3 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
0 1000 2000 255 80 70 1000 0 5000 255 70 80
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #14:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
2088 11589 49794 50 74 197 39482 34249 94468 160 37 6
output:
201310135.43801656365394592285 0.00000000000000000000 345950513.73966944217681884766
result:
ok 3 numbers
Test #15:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
51902 63928 83921 242 44 37 68920 49265 66486 37 242 4
output:
52691853.57575757801532745361 55135069.87583582103252410889 0.00000000000000000000
result:
ok 3 numbers
Test #16:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
12086 45400 84815 34 177 73 13903 1944 25669 245 36 71
output:
13014112.38569488190114498138 13191222.58940697275102138519 0.00000000000000000000
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
6872 17701 20950 247 6 1 21542 48952 90939 7 169 20
output:
65678721.06718750298023223877 67937041.10429447889328002930 0.00000000000000000000
result:
ok 3 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
23054 31939 71419 39 43 178 79732 25616 77333 205 55 41
output:
706096329.82044875621795654297 0.00000000000000000000 471814934.45319414138793945312
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
72463 11051 89269 58 182 50 77950 55529 86785 46 9 204
output:
0.00000000000000000000 66277035.95568393170833587646 75978498.25451171398162841797
result:
ok 3 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
43212 19326 62326 44 27 228 75450 58082 85211 44 180 47
output:
0.00000000000000000000 141416983.44226372241973876953 409717736.96885812282562255859
result:
ok 3 numbers
Test #21:
score: 0
Accepted
time: 1ms
memory: 3964kb
input:
36950 6955 51410 168 1 28 91461 18712 93316 34 34 237
output:
340343411.48240143060684204102 0.00000000000000000000 1167372498.73616051673889160156
result:
ok 3 numbers
Test #22:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
60250 20949 98693 46 249 30 87595 20162 70798 196 8 44
output:
413587603.83447259664535522461 397155724.65199995040893554688 0.00000000000000000000
result:
ok 3 numbers
Test #23:
score: 0
Accepted
time: 1ms
memory: 3976kb
input:
39757 85711 91706 55 181 47 76150 63728 89807 60 75 197
output:
0.00000000000000000000 53460391.80906666815280914307 0.00000000000000000000
result:
ok 3 numbers
Test #24:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
14989 24328 84695 0 0 0 82788 95102 98565 255 255 255
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #25:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
65115 26976 85220 255 0 0 80275 70453 96243 255 0 0
output:
636977720.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
24932 14186 46205 0 255 0 72534 47190 51666 0 255 0
output:
0.00000000000000000000 868617495.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
15628 12010 95180 0 0 255 86243 9027 75885 0 0 255
output:
0.00000000000000000000 0.00000000000000000000 5297113610.00000000000000000000
result:
ok 3 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
53808 24611 48271 0 255 255 78724 42729 63863 0 255 255
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #29:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
47151 6823 18005 255 0 255 60107 48980 85238 255 0 255
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #30:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
25961 18270 37223 255 255 0 34488 32109 35238 255 255 0
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
27019 37875 50350 150 0 0 80548 35967 45816 150 0 0
output:
597490698.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
43817 58155 63638 0 150 0 67353 40148 94799 0 150 0
output:
0.00000000000000000000 707656912.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
17883 12199 12579 0 0 150 43763 57151 92475 0 0 150
output:
0.00000000000000000000 0.00000000000000000000 462009760.00000000000000000000
result:
ok 3 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
3760 81717 92839 150 75 75 22420 47952 66144 150 75 75
output:
273499620.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
24120 43360 60521 75 150 75 76486 5773 47129 75 150 75
output:
0.00000000000000000000 1532150611.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
31278 31002 77751 75 75 150 63805 1954 36070 75 75 150
output:
0.00000000000000000000 0.00000000000000000000 1315147927.50000000000000000000
result:
ok 3 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
55896 42144 62511 140 40 90 81612 33284 77007 160 80 20
output:
351257254.87500000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #38:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
54346 17898 29934 90 140 40 68366 19482 31641 20 160 80
output:
0.00000000000000000000 63723857.34375000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
68298 38275 89969 40 90 140 82546 31143 55084 80 20 160
output:
0.00000000000000000000 0.00000000000000000000 174255600.18750000000000000000
result:
ok 3 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
51955 16926 19423 255 0 0 65803 24209 35160 0 0 0
output:
24162891.23875432834029197693 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #41:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
38117 35974 61581 0 255 0 58199 51083 90020 0 0 0
output:
0.00000000000000000000 234439491.61245670914649963379 0.00000000000000000000
result:
ok 3 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
71296 50305 89064 0 0 255 98723 31860 50378 0 0 0
output:
0.00000000000000000000 0.00000000000000000000 390660745.14013844728469848633
result:
ok 3 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
24504 7347 80033 150 75 0 46739 30661 95335 0 75 150
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
62039 66239 66588 0 150 75 86256 24430 70272 150 0 75
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #45:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
21864 17754 21162 75 0 150 62631 40978 48396 75 150 0
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
23951 45985 96456 150 255 255 59171 7078 15703 150 75 75
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
37880 15384 72825 255 150 255 44265 59408 65002 75 150 75
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
21067 1757 75375 255 255 150 63222 4976 21516 75 75 150
output:
0.00000000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
23659 21454 36284 150 255 255 38361 56012 97445 150 74 74
output:
3359489.12404992943629622459 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
5003 4873 87896 255 150 255 21506 55277 90792 74 150 74
output:
0.00000000000000000000 3250109.71603430062532424927 0.00000000000000000000
result:
ok 3 numbers
Test #51:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
10158 17739 94440 255 255 150 70980 78115 79049 74 74 150
output:
0.00000000000000000000 0.00000000000000000000 384187.07075485977111384273
result:
ok 3 numbers
Test #52:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
7325 22346 91217 200 0 0 96348 47582 54639 0 0 200
output:
1360811141.93750000000000000000 0.00000000000000000000 329023444.06250000000000000000
result:
ok 3 numbers
Test #53:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
2266 6600 77536 0 200 0 30793 25851 88669 200 0 0
output:
455239214.81250000000000000000 498660874.68750000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #54:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
84306 63330 73678 0 0 200 95136 34678 92792 0 200 0
output:
0.00000000000000000000 141177849.37500000000000000000 44183015.62500000000000000000
result:
ok 3 numbers
Test #55:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
97528 12352 78709 200 100 100 97929 791 64920 0 0 200
output:
0.00000000000000000000 0.00000000000000000000 9706217.53125000000000000000
result:
ok 3 numbers
Test #56:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
5260 4966 16978 100 200 100 55192 9215 80160 200 0 0
output:
1121505097.78125000000000000000 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #57:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
76254 60754 72798 100 100 200 87060 42977 79719 0 200 0
output:
0.00000000000000000000 130122306.28125000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #58:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
0 0 100000 0 0 255 100000 0 100000 0 0 255
output:
0.00000000000000000000 0.00000000000000000000 10000000000.00000000000000000000
result:
ok 3 numbers
Test #59:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0 0 100000 242 132 79 100000 0 100000 173 6 32
output:
5476190476.19047737121582031250 0.00000000000000000000 0.00000000000000000000
result:
ok 3 numbers
Test #60:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
0 0 100000 255 0 0 100000 0 100000 0 0 255
output:
2941176470.58823537826538085938 0.00000000000000000000 2941176470.58823490142822265625
result:
ok 3 numbers