返回题库

HMMT 二月 2024 · 冲刺赛 · 第 35 题

HMMT February 2024 — Guts Round — Problem 35

专题
Contest Math / 竞赛数学
难度
L3
来源
HMMT

题目详情

英文原题

  1. [20] Barry picks infinitely many points inside a unit circle, each independently and uniformly at random,
    P , P , . . . . Compute the expected value of N , where N is the smallest integer such that P is inside
    1 2 N +1
    the convex hull formed by the points P , P , . . . , P .
    1 2 N
    Submit a positive real number E . If the correct answer is A , you will receive
    ⌊ 100 · max(0 . 2099 − | E − A | , 0) ⌋ points.
解析

英文解析

  1. [20] Barry picks infinitely many points inside a unit circle, each independently and uniformly atrandom, P , P , . . . . Compute the expected value of N , where N is the smallest integer such that
    1 2
    P is inside the convex hull formed by the points P , P , . . . , P .
    N +1 1 2 N
    Submit a positive real number E . If the correct answer is A , you will receive ⌊ 100 · max(0 . 2099 − | E − A | , 0) ⌋
    points.
    Proposed by: Albert Wang, Rishabh Das
    Answer: 6 . 54
    Solution: Clearly, N ≥ 3 , and let’s scale the circle to have area 1 . We can see that the probabilityto not reach N = 4 is equal to the probability that the fourth point is inside the convex hull of thepast three points. That is, the probability is just one minus the expected area of those N points. Thearea of this turns out to be really small, and is around 0 . 074 , and so (1 − 0 . 074) of all sequences ofpoints make it to N = 4 . The probability to reach to the fifth point from there should be around
    (1 − 0 . 074)(1 − 0 . 074 · 2) , as any four points in convex configuration can be covered with 2 triangles.
    Similarly, the chance of reaching N = 6 should be around (1 − 0 . 074)(1 − 0 . 074 · 2)(1 − 0 . 074 · 3) , andso on. Noting that our terms eventually decay to zero around term 1 / 0 . 074 = 13 , our answer should be an underestimate. In particular, we get
    3 + (1 − 0 . 074)(1 + (1 − 0 . 074 · 2)(1 + (1 − 0 . 074 · 3)(1 + · · · ))) ≈ 6 . 3 .
    Guessing anything slightly above this lower bound should give a positive score.
    Here is a Python code that simulates the result.
    from random import randrange ,getrandbitsimport itertools , mathfrom tqdm import tqdmimport numpy as np
    DEBUG = Falsedef unit_circle_pt ():
    while True:
    x = randrange(-(2 ** 32),2 ** 32+1)
    y = randrange(-(2 ** 32),2 ** 32+1)
    if xx + yy < 2 ** 64:
    return (x,y)
    def area_of_triangle(p 1 , p 2 , p 3):
    return abs((p 2[0] - p 1[0])(p 3[1] - p 2[1]) - (p 2[1] - p 1[1])(p 3[0] - p 2[0]))
    def pt_inside_polygon(point , polygon):

point is a pair

polygon is an angle -sorted list of points that are the vertices of a convex polygon insome order

area of polygon

plot the polygon and the pointif DEBUG:

import matplotlib.pyplot as plt

plot the big circlecircle = plt.Circle ((0,0), 2 ** 32 , color='b', fill=False)

fix view to circleplt.xlim(-2 ** 32 ,2 ** 32)

plt.ylim(-2 ** 32 ,2 ** 32)
plt.gca().add_artist(circle)

make the window to scaleplt.gca().set_aspect('equal ', adjustable='box')

plt.plot([x for x,_ in polygon], [y for _,y in polygon])
plt.scatter([point[0]], [point[1]])
plt.show()
area = 0
for i in range (1, len(polygon)-1):

add on area between points 0, i, i+1

area += area_of_triangle(polygon[0], polygon[i], polygon[i+1])

point is inside polygon if the area of the triangles formed by the point and each edgeof the polygon sum to the area of thepolygonarea_sum = 0

for i in range (len(polygon)):

add on area between points point , polygon [i], polygon [(i+1) % len( polygon )]

area_sum += area_of_triangle(point , polygon[i], polygon[(i+1) % len(polygon)])
return area_sum == areadef convex_hull(points):

sort by x, then ypoints = sorted (points , key= lambda x: (x[0], x[1]))

graham scan

find the lowest pointlowest = points[0]

for p in points:
if p[1] < lowest[1]:
lowest = p

sort by anglepoints = sorted (points , key= lambda x: (math.atan 2(x[1]-lowest[1], x[0]-lowest[0]), -x[1]

, x[0]))

remove duplicatespoints = list(k for k,_ in itertools.groupby(points))

stack to hold the pointsstack = []

for p in points:
while len(stack) > 1 and (stack[-1][0]-stack[-2][0])(p[1]-stack[-2][1]) - (stack[-1
][1]-stack[-2][1])
(p[0]-stack[-2][
0]) <= 0:
stack.pop()
stack.append(p)
return stackdef pulse(horizon=1000):
cur = [unit_circle_pt () for _ in range (3)]
for N in range (3, horizon):
pt = unit_circle_pt ()
if pt_inside_polygon(pt , cur):
return Ncur = convex_hull(cur + [pt])
trials = 1000
blocks = 100000
cur_trials = 0
cur_sum = 0
results = []
for block in range (trials):
for _ in tqdm( range (blocks)):
results.append(pulse ())
cur_trials += blocksmean = np.mean(results)
stddev = np.std(results)
z = 5.0
ci = (mean - zstddev/np.sqrt(cur_trials), mean + zstddev/np.sqrt(cur_trials))
print (block+1, mean , stddev , ci)