QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#628128#7727. Linear GradientPlentyOfPenalty#AC ✓1ms3952kbC++201.9kb2024-10-10 18:45:422024-10-10 18:45:43

Judging History

你现在查看的是最新测评结果

  • [2024-10-10 18:45:43]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3952kb
  • [2024-10-10 18:45:42]
  • 提交

answer

#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) begin(x), end(x)
#ifdef memset0
#define log(...) fprintf(stderr, __VA_ARGS__)
#else
#define endl '\n'
#define log(...) (void(0))
#endif
using namespace std;
using ll = long long;
using lf = long double;
using ull = unsigned long long;
int xa, yal, yar, xb, ybl, ybr;
int rl, gl, bl, rr, gr, br;
struct seg {
  lf l, r;
  seg operator*(const seg &y) const { return (seg){max(l, y.l), min(r, y.r)}; }
};
seg Calc(int s, int t, int g, int ge) {
  // cerr << "CALC " << s << " " << t << " " << g << " " << ge << "\n";
  if (s == t) {
    if ((ge && s >= g) || (!ge && s <= g)) return (seg){0.0, 1.0};
    return (seg){0.0, 0.0};
  }
  lf pos;
  if (g <= s && g <= t) {
    pos = (t < s);
  } else if (g >= t && g >= s) {
    pos = (t > s);
  } else
    pos = (1.0 * g - s) / (1.0 * t - s);
  // cerr << "POS=" << pos << "\n";
  if (ge ^ (s > t)) return (seg){pos, 1.0};
  return (seg){0.0, pos};
}
double lenl, lenr;
const double eps = 1e-10;
double Area(seg ss) {
  // cerr << "AREA " << ss.l << " " << ss.r << "\n";
  double l = ss.l, r = ss.r;
  if (r - l < eps) return 0;
  return ((lenl * (1.0 - l) + lenr * l) + (lenl * (1.0 - r) + lenr * r)) * xb * (r - l) / 2.0;
}
int main() {
#ifdef memset0
  freopen("L.in", "r", stdin);
#endif
  cin.tie(0)->sync_with_stdio(0);
  cin >> xa >> yal >> yar >> rl >> gl >> bl;
  cin >> xb >> ybl >> ybr >> rr >> gr >> br;
  lenl = yar - yal;
  lenr = ybr - ybl;
  xb -= xa, xa = 0;
  cout << fixed << setprecision(10) << Area(Calc(rl, rr, 150, 1) * Calc(gl, gr, 75, 0) * Calc(bl, br, 75, 0)) << "\n";
  cout << fixed << setprecision(10) << Area(Calc(gl, gr, 150, 1) * Calc(bl, br, 75, 0) * Calc(rl, rr, 75, 0)) << "\n";
  cout << fixed << setprecision(10) << Area(Calc(bl, br, 150, 1) * Calc(rl, rr, 75, 0) * Calc(gl, gr, 75, 0)) << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3776kb

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: 3712kb

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: 3708kb

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: 3908kb

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: 3848kb

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: 3900kb

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: 3832kb

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: 3912kb

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: 3900kb

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: 3848kb

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: 3908kb

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: 3900kb

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: 0ms
memory: 3848kb

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: 3856kb

input:

51902 63928 83921 242 44 37
68920 49265 66486 37 242 4

output:

52691853.5757575780
55135069.8758358285
0.0000000000

result:

ok 3 numbers

Test #16:

score: 0
Accepted
time: 1ms
memory: 3900kb

input:

12086 45400 84815 34 177 73
13903 1944 25669 245 36 71

output:

13014112.3856948819
13191222.5894069709
0.0000000000

result:

ok 3 numbers

Test #17:

score: 0
Accepted
time: 0ms
memory: 3948kb

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: 3900kb

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: 3712kb

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: 3828kb

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: 3712kb

input:

36950 6955 51410 168 1 28
91461 18712 93316 34 34 237

output:

340343411.4824014306
0.0000000000
1167372498.7361607552

result:

ok 3 numbers

Test #22:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

60250 20949 98693 46 249 30
87595 20162 70798 196 8 44

output:

413587603.8344725966
397155724.6520000100
0.0000000000

result:

ok 3 numbers

Test #23:

score: 0
Accepted
time: 0ms
memory: 3896kb

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: 3772kb

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: 3844kb

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: 3904kb

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: 3848kb

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: 3872kb

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: 3772kb

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: 3848kb

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: 3904kb

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: 3848kb

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: 3772kb

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: 3860kb

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: 3840kb

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: 3900kb

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: 3896kb

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: 3904kb

input:

51955 16926 19423 255 0 0
65803 24209 35160 0 0 0

output:

24162891.2387543246
0.0000000000
0.0000000000

result:

ok 3 numbers

Test #41:

score: 0
Accepted
time: 0ms
memory: 3904kb

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: 3904kb

input:

71296 50305 89064 0 0 255
98723 31860 50378 0 0 0

output:

0.0000000000
0.0000000000
390660745.1401383877

result:

ok 3 numbers

Test #43:

score: 0
Accepted
time: 0ms
memory: 3908kb

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: 3952kb

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: 3904kb

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: 3772kb

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: 3864kb

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: 3900kb

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: 3844kb

input:

23659 21454 36284 150 255 255
38361 56012 97445 150 74 74

output:

3359489.1240499290
0.0000000000
0.0000000000

result:

ok 3 numbers

Test #50:

score: 0
Accepted
time: 0ms
memory: 3904kb

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: 3900kb

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: 3904kb

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: 3840kb

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: 3888kb

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: 3908kb

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: 3804kb

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: 3900kb

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: 3908kb

input:

0 0 100000 242 132 79
100000 0 100000 173 6 32

output:

5476190476.1904764175
0.0000000000
0.0000000000

result:

ok 3 numbers

Test #60:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

0 0 100000 255 0 0
100000 0 100000 0 0 255

output:

2941176470.5882353783
0.0000000000
2941176470.5882349014

result:

ok 3 numbers