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)
directions = [(to_pos[0] > ghost_pos[0]) - (to_pos[0] < ghost_pos[0]),
(to_pos[1] > ghost_pos[1]) - (to_pos[1] < ghost_pos[1]),
(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] += directions[axis]
if tuple(next_pos) in poses:
ghost_pos[axis] += directions[axis]
moved = True
break
if not moved:
print("NO")
return
print("YES")
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 3004 KiB | ||||
2 | Accepted | 17ms | 3128 KiB | ||||
3 | Accepted | 17ms | 3120 KiB | ||||
subtask2 | 18/18 | ||||||
4 | Accepted | 17ms | 3128 KiB | ||||
5 | Accepted | 17ms | 3136 KiB | ||||
6 | Accepted | 163ms | 3204 KiB | ||||
7 | Accepted | 46ms | 3220 KiB | ||||
8 | Accepted | 39ms | 3024 KiB | ||||
9 | Accepted | 17ms | 3128 KiB | ||||
10 | Accepted | 46ms | 3236 KiB | ||||
11 | Accepted | 39ms | 3088 KiB | ||||
12 | Accepted | 17ms | 3128 KiB | ||||
13 | Accepted | 41ms | 2996 KiB | ||||
subtask3 | 0/19 | ||||||
14 | Accepted | 27ms | 5708 KiB | ||||
15 | Accepted | 712ms | 3252 KiB | ||||
16 | Accepted | 35ms | 5432 KiB | ||||
17 | Accepted | 35ms | 5812 KiB | ||||
18 | Time limit exceeded | 3.098s | 5740 KiB | ||||
19 | Time limit exceeded | 3.098s | 5740 KiB | ||||
20 | Accepted | 17ms | 3180 KiB | ||||
21 | Accepted | 23ms | 4408 KiB | ||||
22 | Accepted | 250ms | 5812 KiB | ||||
23 | Time limit exceeded | 3.084s | 5732 KiB | ||||
24 | Time limit exceeded | 3.078s | 5684 KiB | ||||
25 | Accepted | 82ms | 5856 KiB | ||||
26 | Accepted | 45ms | 3208 KiB | ||||
subtask4 | 0/24 | ||||||
27 | Accepted | 166ms | 33404 KiB | ||||
28 | Time limit exceeded | 3.085s | 3676 KiB | ||||
29 | Time limit exceeded | 3.088s | 35100 KiB | ||||
30 | Time limit exceeded | 3.088s | 35768 KiB | ||||
31 | Time limit exceeded | 3.094s | 35180 KiB | ||||
32 | Time limit exceeded | 3.085s | 35864 KiB | ||||
33 | Accepted | 1.287s | 3668 KiB | ||||
34 | Time limit exceeded | 3.101s | 35096 KiB | ||||
35 | Time limit exceeded | 3.089s | 35872 KiB | ||||
36 | Time limit exceeded | 3.092s | 35868 KiB | ||||
37 | Time limit exceeded | 3.078s | 35096 KiB | ||||
38 | Time limit exceeded | 3.101s | 35760 KiB | ||||
39 | Time limit exceeded | 3.089s | 3384 KiB | ||||
subtask5 | 0/22 | ||||||
40 | Accepted | 166ms | 33692 KiB | ||||
41 | Accepted | 870ms | 3252 KiB | ||||
42 | Accepted | 64ms | 13272 KiB | ||||
43 | Accepted | 190ms | 34964 KiB | ||||
44 | Time limit exceeded | 3.089s | 35856 KiB | ||||
45 | Time limit exceeded | 3.078s | 35860 KiB | ||||
46 | Accepted | 17ms | 3232 KiB | ||||
47 | Accepted | 17ms | 3244 KiB | ||||
48 | Accepted | 50ms | 11104 KiB | ||||
49 | Time limit exceeded | 3.084s | 33176 KiB | ||||
50 | Time limit exceeded | 3.085s | 35856 KiB | ||||
51 | Time limit exceeded | 3.085s | 35868 KiB | ||||
52 | Accepted | 2.26s | 35852 KiB | ||||
53 | Accepted | 45ms | 3128 KiB | ||||
subtask6 | 0/17 | ||||||
54 | Accepted | 228ms | 44852 KiB | ||||
55 | Time limit exceeded | 3.085s | 45540 KiB | ||||
56 | Accepted | 197ms | 45260 KiB | ||||
57 | Accepted | 196ms | 44964 KiB | ||||
58 | Time limit exceeded | 3.085s | 45016 KiB | ||||
59 | Time limit exceeded | 3.086s | 44496 KiB | ||||
60 | Accepted | 381ms | 45540 KiB | ||||
61 | Accepted | 214ms | 45284 KiB | ||||
62 | Accepted | 212ms | 45344 KiB | ||||
63 | Time limit exceeded | 3.085s | 44776 KiB | ||||
64 | Time limit exceeded | 3.085s | 44900 KiB | ||||
65 | Time limit exceeded | 3.088s | 44524 KiB | ||||
66 | Time limit exceeded | 3.088s | 25952 KiB |