hiho week 177 register

Ended

Participants:499

Verdict:Accepted
Score:100 / 100
Submitted:2017-11-23 02:12:39

Lang:Python2

Edit
1
2
3
4
5
6
7
8
9
10
def dfs(hxyx1y1x2y2):
    if h <= 0return 0
    l = 0 if h == 1 else 3 * (1 << h - 2) - 1
    X1Y1X2Y2 = xy - lx + ly + l
    if x1 <= X1 <= X2 <= x2 and y1 <= Y1 <= Y2 <= y2return (1 << h) - 1
    if (X1 - x2) * (X2 - x1) > 0 or (Y1 - y2) * (Y2 - y1) > 0return 0
    d = 3 * (1 << h - 3) if h >= 3 else 2
    return (x1 <= x <= x2 and y1 <= y <= y2) + dfs(h - 1x + dy - dx1y1x2y2) + dfs(h - 1x + dy + dx1y1x2y2)
nm = map(intraw_input().split())
for i in range(m)print dfs(n00*map(intraw_input().split()))
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX