Submission #44396116
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
((RX0,RX1),(RY0,RY1)),
((LX0,LX1),(LY0,LY1)),
((UX0,UX1),(UY0,UY1)),
((DX0,DX1),(DY0,DY1)) =
gets.to_i.times.map{
gets.split.then{|x,y,d| [x.to_i,y.to_i,d] }
}.group_by(&:pop).transform_values{|xys|
xys.transpose.map(&:minmax)
}.values_at(*'RLUD'.chars)
S = lambda{|t|
t *= 0.5
l = [RX0,LX0,UX0,DX0].zip([t,-t,0,0]).select{|x,|x}.map(&:sum).min
r = [RX1,LX1,UX1,DX1].zip([t,-t,0,0]).select{|x,|x}.map(&:sum).max
d = [RY0,LY0,UY0,DY0].zip([0,0,t,-t]).select{|y,|y}.map(&:sum).min
u = [RY1,LY1,UY1,DY1].zip([0,0,t,-t]).select{|y,|y}.map(&:sum).max
next (r-l)*(u-d)
}
TX = [0]
TX<<LX1-RX1 if RX1 && LX1 && RX1<LX1
TX<<2*(UX1-RX1) if RX1 && UX1 && RX1<UX1
TX<<2*(DX1-RX1) if RX1 && DX1 && RX1<DX1
TX<<LX0-RX0 if LX0 && RX0 && RX0<LX0
TX<<2*(LX0-UX0) if LX0 && UX0 && UX0<LX0
TX<<2*(LX0-DX0) if LX0 && DX0 && DX0<LX0
TX.sort!.uniq!
TY = [0]
TY<<DX1-UX1 if UX1 && DX1 && UX1<DX1
TY<<2*(RX1-UX1) if UX1 && RX1 && UX1<RX1
TY<<2*(LX1-UX1) if UX1 && LX1 && UX1<LX1
TY<<DX0-UX0 if DX0 && UX0 && UX0<DX0
TY<<2*(DX0-RX0) if DX0 && RX0 && RX0<DX0
TY<<2*(DX0-LX0) if DX0 && LX0 && LX0<DX0
TY.sort!.uniq!
x1 = y1 = 0
while TX[x1]||TY[y1]
TX.delete_at x1 while TX[x1] && TX[x1]<TY[y1] if TY[y1]
y1 += 1
TY.delete_at y1 while TY[y1] && TY[y1]<TX[x1] if TX[x1]
x1 += 1
end
T = 0,*(TX|TY).sort
p T.each_cons(2).map{|t0,t1|
S[t0]<S[t0.to_f.next_float.next_float] ? [S[t0],S[t1]].min : S[(t0...t1).bsearch{|t| S[t]<S[t+1] }||t1]
}.min
Submission Info
Submission Time |
|
Task |
F - Minimum Bounding Box |
User |
ds14050 |
Language |
Ruby (2.7.1) |
Score |
600 |
Code Size |
1480 Byte |
Status |
AC |
Exec Time |
187 ms |
Memory |
28500 KB |
Judge Result
Set Name |
All |
Sample |
Score / Max Score |
600 / 600 |
0 / 0 |
Status |
|
|
Set Name |
Test Cases |
All |
sample_00, sample_01, sample_02, testcase_0_0, testcase_0_1, testcase_0_2, testcase_0_3, testcase_0_4, testcase_0_5, testcase_0_6, testcase_0_7, testcase_0_8, testcase_0_9, testcase_1_0, testcase_1_1, testcase_1_10, testcase_1_11, testcase_1_12, testcase_1_13, testcase_1_2, testcase_1_3, testcase_1_4, testcase_1_5, testcase_1_6, testcase_1_7, testcase_1_8, testcase_1_9, testcase_2_0, testcase_2_1, testcase_3_0, testcase_3_1, testcase_3_2, testcase_3_3, testcase_3_4, testcase_4_0, testcase_5_0, testcase_5_1, testcase_5_10, testcase_5_11, testcase_5_12, testcase_5_13, testcase_5_14, testcase_5_2, testcase_5_3, testcase_5_4, testcase_5_5, testcase_5_6, testcase_5_7, testcase_5_8, testcase_5_9, testcase_6_0, testcase_6_1, testcase_6_2, testcase_6_3, testcase_6_4, testcase_7_0, testcase_7_1, testcase_7_10, testcase_7_11, testcase_7_12, testcase_7_13, testcase_7_14, testcase_7_2, testcase_7_3, testcase_7_4, testcase_7_5, testcase_7_6, testcase_7_7, testcase_7_8, testcase_7_9, testcase_998244353, testcase_pair, testcase_powerful |
Sample |
sample_00, sample_01, sample_02 |
Case Name |
Status |
Exec Time |
Memory |
sample_00 |
AC |
53 ms |
14220 KB |
sample_01 |
AC |
54 ms |
14220 KB |
sample_02 |
AC |
56 ms |
14384 KB |
testcase_0_0 |
AC |
56 ms |
14268 KB |
testcase_0_1 |
AC |
55 ms |
14364 KB |
testcase_0_2 |
AC |
56 ms |
14196 KB |
testcase_0_3 |
AC |
53 ms |
14208 KB |
testcase_0_4 |
AC |
54 ms |
14300 KB |
testcase_0_5 |
AC |
54 ms |
14328 KB |
testcase_0_6 |
AC |
55 ms |
14272 KB |
testcase_0_7 |
AC |
56 ms |
14260 KB |
testcase_0_8 |
AC |
57 ms |
14348 KB |
testcase_0_9 |
AC |
54 ms |
14216 KB |
testcase_1_0 |
AC |
53 ms |
14212 KB |
testcase_1_1 |
AC |
53 ms |
14168 KB |
testcase_1_10 |
AC |
55 ms |
14444 KB |
testcase_1_11 |
AC |
54 ms |
14412 KB |
testcase_1_12 |
AC |
54 ms |
14268 KB |
testcase_1_13 |
AC |
54 ms |
14168 KB |
testcase_1_2 |
AC |
54 ms |
14448 KB |
testcase_1_3 |
AC |
55 ms |
14272 KB |
testcase_1_4 |
AC |
52 ms |
14412 KB |
testcase_1_5 |
AC |
55 ms |
14228 KB |
testcase_1_6 |
AC |
54 ms |
14224 KB |
testcase_1_7 |
AC |
55 ms |
14376 KB |
testcase_1_8 |
AC |
55 ms |
14284 KB |
testcase_1_9 |
AC |
53 ms |
14200 KB |
testcase_2_0 |
AC |
56 ms |
14176 KB |
testcase_2_1 |
AC |
54 ms |
14264 KB |
testcase_3_0 |
AC |
56 ms |
14360 KB |
testcase_3_1 |
AC |
54 ms |
14432 KB |
testcase_3_2 |
AC |
53 ms |
14108 KB |
testcase_3_3 |
AC |
59 ms |
14300 KB |
testcase_3_4 |
AC |
53 ms |
14308 KB |
testcase_4_0 |
AC |
178 ms |
28128 KB |
testcase_5_0 |
AC |
99 ms |
18676 KB |
testcase_5_1 |
AC |
138 ms |
22944 KB |
testcase_5_10 |
AC |
127 ms |
21404 KB |
testcase_5_11 |
AC |
117 ms |
20952 KB |
testcase_5_12 |
AC |
57 ms |
14504 KB |
testcase_5_13 |
AC |
116 ms |
20752 KB |
testcase_5_14 |
AC |
93 ms |
18296 KB |
testcase_5_2 |
AC |
116 ms |
21068 KB |
testcase_5_3 |
AC |
97 ms |
18428 KB |
testcase_5_4 |
AC |
76 ms |
16536 KB |
testcase_5_5 |
AC |
173 ms |
25468 KB |
testcase_5_6 |
AC |
106 ms |
19300 KB |
testcase_5_7 |
AC |
137 ms |
22664 KB |
testcase_5_8 |
AC |
178 ms |
27284 KB |
testcase_5_9 |
AC |
90 ms |
17756 KB |
testcase_6_0 |
AC |
181 ms |
28340 KB |
testcase_6_1 |
AC |
182 ms |
28500 KB |
testcase_6_2 |
AC |
181 ms |
28500 KB |
testcase_6_3 |
AC |
181 ms |
28280 KB |
testcase_6_4 |
AC |
183 ms |
28236 KB |
testcase_7_0 |
AC |
55 ms |
14276 KB |
testcase_7_1 |
AC |
52 ms |
14264 KB |
testcase_7_10 |
AC |
56 ms |
14356 KB |
testcase_7_11 |
AC |
55 ms |
14372 KB |
testcase_7_12 |
AC |
52 ms |
14188 KB |
testcase_7_13 |
AC |
56 ms |
14324 KB |
testcase_7_14 |
AC |
55 ms |
14380 KB |
testcase_7_2 |
AC |
52 ms |
14312 KB |
testcase_7_3 |
AC |
55 ms |
14260 KB |
testcase_7_4 |
AC |
56 ms |
14216 KB |
testcase_7_5 |
AC |
54 ms |
14240 KB |
testcase_7_6 |
AC |
55 ms |
14208 KB |
testcase_7_7 |
AC |
55 ms |
14260 KB |
testcase_7_8 |
AC |
56 ms |
14272 KB |
testcase_7_9 |
AC |
55 ms |
14432 KB |
testcase_998244353 |
AC |
187 ms |
28380 KB |
testcase_pair |
AC |
55 ms |
14316 KB |
testcase_powerful |
AC |
54 ms |
14276 KB |