Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

6 of 6
deleted 35 characters in body
PurkkaKoodari
  • 17.9k
  • 2
  • 37
  • 92

Jelly, (削除) 25 (削除ここまで) (削除) 24 (削除ここまで) (削除) 22 (削除ここまで) (削除) 21 (削除ここまで) (削除) 20 (削除ここまで) 18 bytes

«/r»/Œpμ3_2§1⁄2ṀĊ,)Ṃ

Thanks to @EriktheOutgolfer for letting me know about ), saving 1 byte.

Thanks to @Dennis for saving 2 bytes.

Try it online!

Explanation

«/r»/Œpμ3_2§1⁄2ṀĊ,)Ṃ Main link. Arg: points
 e.g. [[1,4],[3,2],[3,1]]
«/ Find minimums by coordinate
 e.g. [1,1]
 »/ Find maximums by coordinate
 e.g. [3,4]
 r Inclusive ranges by coordinate
 e.g. [[1,2,3],[1,2,3,4]]
 Œp Cartesian product of the x and y ranges
 e.g. [[1,1],[1,2],[1,3],[1,4],...,[3,4]]
 μ Chain, arg: center
 e.g. [1,3]
 3 Get the original points
 e.g. [[1,4],[3,2],[3,1]]
 _ Subtract the center from each
 e.g. [[0,1],[2,-1],[2,-2]]
 2 Square each number
 e.g. [[0,1],[4,1],[4,4]]
 § Sum each sublist
 e.g. [1,5,8]
 1⁄2 Square root of each number
 e.g. [1,2.24,2.83]
 Ṁ Find the maximum
 e.g. 2.83
 Ċ Round up
 e.g. 3
 , Pair with the center point
 e.g. [3,[1,3]]
 ) Do the above for all points
 e.g. [[3,[1,1]],[3,[1,2]],[3,[1,3]],...,[3,[3,4]]]
 Ṃ Find the lexicographically smallest pair
 e.g. [3,[1,1]]
PurkkaKoodari
  • 17.9k
  • 2
  • 37
  • 92

AltStyle によって変換されたページ (->オリジナル) /