QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#628173 | #7727. Linear Gradient | Afterlife# | AC ✓ | 1ms | 3944kb | C++20 | 1.9kb | 2024-10-10 18:59:39 | 2024-10-10 18:59:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int X1,Y1,Y2;
int Rl,Gl,Bl;
int X2,Y3,Y4;
int Rr,Gr,Br;
double calc(double t){
return (Y2-Y1)*(1-t)+(Y4-Y3)*t;
}
double work(){
double l=0,r=1;
if(Rl<=Rr){
if(Rl>150){
}
else if(Rr<150){
return 0;
}
else{
if(Rl!=Rr)
l=max(l,1.0*(150-Rl)/(Rr-Rl));
}
}
else{
if(Rr>150){
}
else if(Rl<150){
return 0;
}
else{
if(Rl!=Rr)
r=min(r,1.0*(Rl-150)/(Rl-Rr));
}
}
if(Gl<=Gr){
if(Gl>75){
return 0;
}
else if(Gr<75){
}
else{
if(Gr!=Gl)
r=min(r,1.0*(75-Gl)/(Gr-Gl));
}
}
else{
if(Gr>75){
return 0;
}
else if(Gl<75){
}
else{
if(Gr!=Gl)
l=max(l,1.0*(Gl-75)/(Gl-Gr));
}
}
if(Bl<=Br){
if(Bl>75){
return 0;
}
else if(Br<75){
}
else{
if(Bl!=Br)
r=min(r,1.0*(75-Bl)/(Br-Bl));
}
}
else{
if(Br>75){
return 0;
}
else if(Bl<75){
}
else{
if(Bl!=Br)
l=max(l,1.0*(Bl-75)/(Bl-Br));
}
}
if(l>r)return 0;
return 0.5*(X2-X1)*(r-l)*(calc(l)+calc(r));
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.setf(ios::fixed);
cout.precision(10);
cin>>X1>>Y1>>Y2>>Rl>>Gl>>Bl;
cin>>X2>>Y3>>Y4>>Rr>>Gr>>Br;
cout<<work()<<'\n';swap(Rl,Gl);
swap(Gl,Bl);
swap(Rr,Gr);
swap(Gr,Br);
cout<<work()<<'\n';swap(Rl,Gl);
swap(Gl,Bl);
swap(Rr,Gr);
swap(Gr,Br);
cout<<work()<<'\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3836kb
input:
0 0 50 255 0 0 100 0 100 0 255 0
output:
1686.8512110727 2724.9134948097 0.0000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2060 62118 92121 239 136 80 61328 12685 18891 50 69 122
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
85238 49611 95092 67 6 208 85360 45143 87657 104 126 133
output:
0.0000000000 0.0000000000 1191253.9839298758
result:
ok 3 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
57680 36610 53516 78 65 31 81738 82352 90031 77 79 44
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
91940 22309 99142 30 143 62 95387 37573 91801 180 71 34
output:
10504908.0416666716 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
68239 45093 91137 51 183 30 86340 11944 39045 0 208 122
output:
0.0000000000 366644421.6236413717 0.0000000000
result:
ok 3 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
5408 36608 48052 206 29 193 65865 29822 78504 214 12 2
output:
960445272.3630108833 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
16857 976 61590 203 5 58 59842 72203 74899 167 139 204
output:
286502399.5611277819 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
65363 17442 63076 12 67 206 83708 28211 29809 182 150 123
output:
0.0000000000 0.0000000000 76937220.3919291645
result:
ok 3 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
73730 85011 89704 19 244 78 84775 10494 71515 178 172 90
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
15380 43193 80471 79 12 138 34588 55347 86722 56 24 213
output:
0.0000000000 0.0000000000 536530146.9413988590
result:
ok 3 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
50 100 300 75 75 150 1000 0 10 75 75 150
output:
0.0000000000 0.0000000000 99750.0000000000
result:
ok 3 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
0 1000 2000 255 80 70 1000 0 5000 255 70 80
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #14:
score: 0
Accepted
time: 1ms
memory: 3944kb
input:
2088 11589 49794 50 74 197 39482 34249 94468 160 37 6
output:
201310135.4380165637 0.0000000000 345950513.7396694422
result:
ok 3 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
51902 63928 83921 242 44 37 68920 49265 66486 37 242 4
output:
52691853.5757575780 55135069.8758358210 0.0000000000
result:
ok 3 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
12086 45400 84815 34 177 73 13903 1944 25669 245 36 71
output:
13014112.3856948819 13191222.5894069728 0.0000000000
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
6872 17701 20950 247 6 1 21542 48952 90939 7 169 20
output:
65678721.0671875030 67937041.1042944789 0.0000000000
result:
ok 3 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
23054 31939 71419 39 43 178 79732 25616 77333 205 55 41
output:
706096329.8204487562 0.0000000000 471814934.4531941414
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
72463 11051 89269 58 182 50 77950 55529 86785 46 9 204
output:
0.0000000000 66277035.9556839317 75978498.2545117140
result:
ok 3 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
43212 19326 62326 44 27 228 75450 58082 85211 44 180 47
output:
0.0000000000 141416983.4422637224 409717736.9688581228
result:
ok 3 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
36950 6955 51410 168 1 28 91461 18712 93316 34 34 237
output:
340343411.4824014306 0.0000000000 1167372498.7361605167
result:
ok 3 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
60250 20949 98693 46 249 30 87595 20162 70798 196 8 44
output:
413587603.8344725966 397155724.6519999504 0.0000000000
result:
ok 3 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
39757 85711 91706 55 181 47 76150 63728 89807 60 75 197
output:
0.0000000000 53460391.8090666682 0.0000000000
result:
ok 3 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
14989 24328 84695 0 0 0 82788 95102 98565 255 255 255
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
65115 26976 85220 255 0 0 80275 70453 96243 255 0 0
output:
636977720.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
24932 14186 46205 0 255 0 72534 47190 51666 0 255 0
output:
0.0000000000 868617495.0000000000 0.0000000000
result:
ok 3 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
15628 12010 95180 0 0 255 86243 9027 75885 0 0 255
output:
0.0000000000 0.0000000000 5297113610.0000000000
result:
ok 3 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
53808 24611 48271 0 255 255 78724 42729 63863 0 255 255
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
47151 6823 18005 255 0 255 60107 48980 85238 255 0 255
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
25961 18270 37223 255 255 0 34488 32109 35238 255 255 0
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
27019 37875 50350 150 0 0 80548 35967 45816 150 0 0
output:
597490698.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
43817 58155 63638 0 150 0 67353 40148 94799 0 150 0
output:
0.0000000000 707656912.0000000000 0.0000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
17883 12199 12579 0 0 150 43763 57151 92475 0 0 150
output:
0.0000000000 0.0000000000 462009760.0000000000
result:
ok 3 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
3760 81717 92839 150 75 75 22420 47952 66144 150 75 75
output:
273499620.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
24120 43360 60521 75 150 75 76486 5773 47129 75 150 75
output:
0.0000000000 1532150611.0000000000 0.0000000000
result:
ok 3 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
31278 31002 77751 75 75 150 63805 1954 36070 75 75 150
output:
0.0000000000 0.0000000000 1315147927.5000000000
result:
ok 3 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
55896 42144 62511 140 40 90 81612 33284 77007 160 80 20
output:
351257254.8750000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
54346 17898 29934 90 140 40 68366 19482 31641 20 160 80
output:
0.0000000000 63723857.3437500000 0.0000000000
result:
ok 3 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
68298 38275 89969 40 90 140 82546 31143 55084 80 20 160
output:
0.0000000000 0.0000000000 174255600.1875000000
result:
ok 3 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
51955 16926 19423 255 0 0 65803 24209 35160 0 0 0
output:
24162891.2387543283 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
38117 35974 61581 0 255 0 58199 51083 90020 0 0 0
output:
0.0000000000 234439491.6124567091 0.0000000000
result:
ok 3 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
71296 50305 89064 0 0 255 98723 31860 50378 0 0 0
output:
0.0000000000 0.0000000000 390660745.1401384473
result:
ok 3 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
24504 7347 80033 150 75 0 46739 30661 95335 0 75 150
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
62039 66239 66588 0 150 75 86256 24430 70272 150 0 75
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
21864 17754 21162 75 0 150 62631 40978 48396 75 150 0
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
23951 45985 96456 150 255 255 59171 7078 15703 150 75 75
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
37880 15384 72825 255 150 255 44265 59408 65002 75 150 75
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
21067 1757 75375 255 255 150 63222 4976 21516 75 75 150
output:
0.0000000000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
23659 21454 36284 150 255 255 38361 56012 97445 150 74 74
output:
3359489.1240499294 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
5003 4873 87896 255 150 255 21506 55277 90792 74 150 74
output:
0.0000000000 3250109.7160343006 0.0000000000
result:
ok 3 numbers
Test #51:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
10158 17739 94440 255 255 150 70980 78115 79049 74 74 150
output:
0.0000000000 0.0000000000 384187.0707548598
result:
ok 3 numbers
Test #52:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
7325 22346 91217 200 0 0 96348 47582 54639 0 0 200
output:
1360811141.9375000000 0.0000000000 329023444.0625000000
result:
ok 3 numbers
Test #53:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
2266 6600 77536 0 200 0 30793 25851 88669 200 0 0
output:
455239214.8125000000 498660874.6875000000 0.0000000000
result:
ok 3 numbers
Test #54:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
84306 63330 73678 0 0 200 95136 34678 92792 0 200 0
output:
0.0000000000 141177849.3750000000 44183015.6250000000
result:
ok 3 numbers
Test #55:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
97528 12352 78709 200 100 100 97929 791 64920 0 0 200
output:
0.0000000000 0.0000000000 9706217.5312500000
result:
ok 3 numbers
Test #56:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
5260 4966 16978 100 200 100 55192 9215 80160 200 0 0
output:
1121505097.7812500000 0.0000000000 0.0000000000
result:
ok 3 numbers
Test #57:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
76254 60754 72798 100 100 200 87060 42977 79719 0 200 0
output:
0.0000000000 130122306.2812500000 0.0000000000
result:
ok 3 numbers
Test #58:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
0 0 100000 0 0 255 100000 0 100000 0 0 255
output:
0.0000000000 0.0000000000 10000000000.0000000000
result:
ok 3 numbers
Test #59:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
0 0 100000 242 132 79 100000 0 100000 173 6 32
output:
5476190476.1904773712 0.0000000000 0.0000000000
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.5882353783 0.0000000000 2941176470.5882349014
result:
ok 3 numbers