# asda

a guest
Jan 14th, 2020
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. dots = []
2. n = int(input())
3. for i in range(n):
4.     temp = [int(i) for i in input().split()]
5.     dots.append(temp)
6. moves = [int(i) for i in input().split()]
7. versh1, versh2 = map(int, input().split())
8. for j in moves:
9.     j -= 1
10.     len_x = 0
11.     len_y = 0
12.     dot_index_x = None
13.     dot_index_y = None
14.     dot_index = None
15.     temp_dot = dots[j]
16.     for i in range(len(dots)):
17.         temp = dots[i]
18.         if temp_dot[0] == temp[0]:
19.             temp_len = abs(temp_dot[1] - temp[1])
20.             if len_y < temp_len:
21.                 len_y = temp_len
22.                 dot_index_y = i
23.         if temp_dot[1] == temp[1]:
24.             temp_len = abs(temp_dot[0] - temp[0])
25.             if len_x < temp_len:
26.                 len_x = temp_len
27.                 dot_index_x = i
28.     if len_x == 0 and len_y == 0:
29.         continue
30.     if len_x >= len_y:
31.         if dots[dot_index_x][0] > dots[j][0]:
32.             dots[j][0] += 2 * len_x
33.         else:
34.             dots[j][0] -= 2 * len_x
35.     else:
36.         if dots[dot_index_y][1] > dots[j][1]:
37.             dots[j][1] += 2 * len_y
38.         else:
39.             dots[j][1] -= 2 * len_y
40. versh1 = dots[versh1 - 1]
41. versh2 = dots[versh2 - 1]
42. if versh1[0] == versh2[0] or versh1[1] == versh2[1]:
43.     print(0)
44. else:
45.     if versh1[0] > versh2[0]:
46.         len1 = versh1[0] - versh2[0]
47.     else:
48.         len1 = versh2[0] - versh1[0]
49.     if versh1[1] > versh2[1]:
50.         len2 = versh1[1] - versh2[1]
51.     else:
52.         len2 = versh2[1] - versh1[1]
53.     print(len1 * len2)
RAW Paste Data