115612024-10-26 22:26:25balintPac-Manpython3Time limit exceeded 18/1003.101s45540 KiB
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()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3004 KiB
2Accepted17ms3128 KiB
3Accepted17ms3120 KiB
subtask218/18
4Accepted17ms3128 KiB
5Accepted17ms3136 KiB
6Accepted163ms3204 KiB
7Accepted46ms3220 KiB
8Accepted39ms3024 KiB
9Accepted17ms3128 KiB
10Accepted46ms3236 KiB
11Accepted39ms3088 KiB
12Accepted17ms3128 KiB
13Accepted41ms2996 KiB
subtask30/19
14Accepted27ms5708 KiB
15Accepted712ms3252 KiB
16Accepted35ms5432 KiB
17Accepted35ms5812 KiB
18Time limit exceeded3.098s5740 KiB
19Time limit exceeded3.098s5740 KiB
20Accepted17ms3180 KiB
21Accepted23ms4408 KiB
22Accepted250ms5812 KiB
23Time limit exceeded3.084s5732 KiB
24Time limit exceeded3.078s5684 KiB
25Accepted82ms5856 KiB
26Accepted45ms3208 KiB
subtask40/24
27Accepted166ms33404 KiB
28Time limit exceeded3.085s3676 KiB
29Time limit exceeded3.088s35100 KiB
30Time limit exceeded3.088s35768 KiB
31Time limit exceeded3.094s35180 KiB
32Time limit exceeded3.085s35864 KiB
33Accepted1.287s3668 KiB
34Time limit exceeded3.101s35096 KiB
35Time limit exceeded3.089s35872 KiB
36Time limit exceeded3.092s35868 KiB
37Time limit exceeded3.078s35096 KiB
38Time limit exceeded3.101s35760 KiB
39Time limit exceeded3.089s3384 KiB
subtask50/22
40Accepted166ms33692 KiB
41Accepted870ms3252 KiB
42Accepted64ms13272 KiB
43Accepted190ms34964 KiB
44Time limit exceeded3.089s35856 KiB
45Time limit exceeded3.078s35860 KiB
46Accepted17ms3232 KiB
47Accepted17ms3244 KiB
48Accepted50ms11104 KiB
49Time limit exceeded3.084s33176 KiB
50Time limit exceeded3.085s35856 KiB
51Time limit exceeded3.085s35868 KiB
52Accepted2.26s35852 KiB
53Accepted45ms3128 KiB
subtask60/17
54Accepted228ms44852 KiB
55Time limit exceeded3.085s45540 KiB
56Accepted197ms45260 KiB
57Accepted196ms44964 KiB
58Time limit exceeded3.085s45016 KiB
59Time limit exceeded3.086s44496 KiB
60Accepted381ms45540 KiB
61Accepted214ms45284 KiB
62Accepted212ms45344 KiB
63Time limit exceeded3.085s44776 KiB
64Time limit exceeded3.085s44900 KiB
65Time limit exceeded3.088s44524 KiB
66Time limit exceeded3.088s25952 KiB