QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#628147 | #7727. Linear Gradient | Afterlife# | WA | 0ms | 3904kb | C++20 | 1.8kb | 2024-10-10 18:54:04 | 2024-10-10 18:54:05 |
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{
l=max(l,1.0*(150-Rl)/(Rr-Rl));
}
}
else{
if(Rr>=150){
}
else if(Rl<=150){
return 0;
}
else{
r=min(r,1.0*(Rl-150)/(Rl-Rr));
}
}
if(Gl<=Gr){
if(Gl>=75){
return 0;
}
else if(Gr<=75){
}
else{
r=min(r,1.0*(75-Gl)/(Gr-Gl));
}
}
else{
if(Gr>=75){
return 0;
}
else if(Gl<=75){
}
else{
l=max(l,1.0*(Gl-75)/(Gl-Gr));
}
}
if(Bl<=Br){
if(Bl>=75){
return 0;
}
else if(Br<=75){
}
else{
r=min(r,1.0*(75-Bl)/(Br-Bl));
}
}
else{
if(Br>=75){
return 0;
}
else if(Bl<=75){
}
else{
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3896kb
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: 3808kb
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: 3852kb
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: 3844kb
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: 3764kb
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: 3896kb
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: 3764kb
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: 3844kb
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: 3840kb
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: -100
Wrong Answer
time: 0ms
memory: 3856kb
input:
50 100 300 75 75 150 1000 0 10 75 75 150
output:
0.0000000000 0.0000000000 0.0000000000
result:
wrong answer 3rd numbers differ - expected: '99750.0000000', found: '0.0000000', error = '1.0000000'