from itertools import combinations
def main():
input()
poses = {tuple(map(int, x)) for x in zip(*[input().strip().split() for _ in range(3)])}
for from_pos, to_pos in combinations(poses, 2):
ghost_pos = list(from_pos)
x_dir = (to_pos[0] > ghost_pos[0]) - (to_pos[0] < ghost_pos[0])
y_dir = (to_pos[1] > ghost_pos[1]) - (to_pos[1] < ghost_pos[1])
z_dir = (to_pos[2] > ghost_pos[2]) - (to_pos[2] < ghost_pos[2])
while ghost_pos != list(to_pos):
moved = False
for axis in range(3):
if ghost_pos[axis] != to_pos[axis]:
next_pos = ghost_pos[:]
next_pos[axis] += (x_dir if axis == 0 else (y_dir if axis == 1 else z_dir))
if tuple(next_pos) in poses:
ghost_pos[axis] += (x_dir if axis == 0 else (y_dir if axis == 1 else z_dir))
moved = True
break
if not moved:
print("NO")
return
print("YES")
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 3128 KiB | ||||
2 | Accepted | 16ms | 3128 KiB | ||||
3 | Accepted | 16ms | 3128 KiB | ||||
subtask2 | 18/18 | ||||||
4 | Accepted | 17ms | 3248 KiB | ||||
5 | Accepted | 17ms | 3256 KiB | ||||
6 | Accepted | 171ms | 3260 KiB | ||||
7 | Accepted | 46ms | 3260 KiB | ||||
8 | Accepted | 39ms | 3216 KiB | ||||
9 | Accepted | 17ms | 3132 KiB | ||||
10 | Accepted | 46ms | 3128 KiB | ||||
11 | Accepted | 37ms | 3264 KiB | ||||
12 | Accepted | 17ms | 3064 KiB | ||||
13 | Accepted | 41ms | 3128 KiB | ||||
subtask3 | 0/19 | ||||||
14 | Accepted | 28ms | 5688 KiB | ||||
15 | Accepted | 741ms | 3272 KiB | ||||
16 | Accepted | 37ms | 5428 KiB | ||||
17 | Accepted | 37ms | 5820 KiB | ||||
18 | Time limit exceeded | 3.081s | 5812 KiB | ||||
19 | Time limit exceeded | 3.099s | 5896 KiB | ||||
20 | Accepted | 17ms | 3128 KiB | ||||
21 | Accepted | 23ms | 4408 KiB | ||||
22 | Accepted | 263ms | 5812 KiB | ||||
23 | Time limit exceeded | 3.085s | 5912 KiB | ||||
24 | Time limit exceeded | 3.085s | 5912 KiB | ||||
25 | Accepted | 83ms | 5912 KiB | ||||
26 | Accepted | 46ms | 3212 KiB | ||||
subtask4 | 0/24 | ||||||
27 | Accepted | 185ms | 33200 KiB | ||||
28 | Time limit exceeded | 3.084s | 3904 KiB | ||||
29 | Time limit exceeded | 3.085s | 34980 KiB | ||||
30 | Time limit exceeded | 3.085s | 35748 KiB | ||||
31 | Time limit exceeded | 3.091s | 35500 KiB | ||||
32 | Time limit exceeded | 3.082s | 35132 KiB | ||||
33 | Accepted | 1.338s | 3640 KiB | ||||
34 | Time limit exceeded | 3.085s | 34724 KiB | ||||
35 | Time limit exceeded | 3.092s | 35328 KiB | ||||
36 | Time limit exceeded | 3.082s | 35184 KiB | ||||
37 | Time limit exceeded | 3.084s | 35496 KiB | ||||
38 | Time limit exceeded | 3.086s | 35340 KiB | ||||
39 | Time limit exceeded | 3.078s | 3404 KiB | ||||
subtask5 | 0/22 | ||||||
40 | Accepted | 180ms | 33844 KiB | ||||
41 | Accepted | 904ms | 3128 KiB | ||||
42 | Accepted | 57ms | 13192 KiB | ||||
43 | Accepted | 166ms | 34832 KiB | ||||
44 | Time limit exceeded | 3.088s | 35884 KiB | ||||
45 | Time limit exceeded | 3.088s | 35856 KiB | ||||
46 | Accepted | 17ms | 3128 KiB | ||||
47 | Accepted | 17ms | 3256 KiB | ||||
48 | Accepted | 50ms | 11324 KiB | ||||
49 | Time limit exceeded | 3.086s | 33320 KiB | ||||
50 | Time limit exceeded | 3.092s | 35880 KiB | ||||
51 | Time limit exceeded | 3.088s | 35884 KiB | ||||
52 | Accepted | 2.354s | 35868 KiB | ||||
53 | Accepted | 46ms | 3128 KiB | ||||
subtask6 | 0/17 | ||||||
54 | Accepted | 200ms | 44988 KiB | ||||
55 | Time limit exceeded | 3.092s | 45404 KiB | ||||
56 | Accepted | 228ms | 45260 KiB | ||||
57 | Accepted | 201ms | 44580 KiB | ||||
58 | Time limit exceeded | 3.101s | 45276 KiB | ||||
59 | Time limit exceeded | 3.101s | 44676 KiB | ||||
60 | Accepted | 342ms | 45392 KiB | ||||
61 | Accepted | 188ms | 45284 KiB | ||||
62 | Accepted | 214ms | 45272 KiB | ||||
63 | Time limit exceeded | 3.078s | 44940 KiB | ||||
64 | Time limit exceeded | 3.091s | 44972 KiB | ||||
65 | Time limit exceeded | 3.088s | 44564 KiB | ||||
66 | Time limit exceeded | 3.088s | 26528 KiB |