115632024-10-26 22:55:09balintPac-Manpython3Time limit exceeded 18/1003.099s45516 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)

        dirs = ((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):
            for axis in range(3):
                if ghost_pos[axis] != to_pos[axis]:
                    next_pos = ghost_pos[:]
                    next_pos[axis] += dirs[axis]
                    if tuple(next_pos) in poses:
                        ghost_pos[axis] += dirs[axis]
                        break

            else: 
                print("NO")
                return 

    print("YES")

main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3140 KiB
2Accepted16ms3144 KiB
3Accepted16ms3128 KiB
subtask218/18
4Accepted17ms3128 KiB
5Accepted16ms3080 KiB
6Accepted159ms3204 KiB
7Accepted46ms3240 KiB
8Accepted37ms3212 KiB
9Accepted17ms3128 KiB
10Accepted45ms3128 KiB
11Accepted37ms3212 KiB
12Accepted16ms3128 KiB
13Accepted41ms3080 KiB
subtask30/19
14Accepted26ms5556 KiB
15Accepted693ms3192 KiB
16Accepted34ms5176 KiB
17Accepted37ms5688 KiB
18Time limit exceeded3.088s5772 KiB
19Time limit exceeded3.099s5844 KiB
20Accepted17ms3172 KiB
21Accepted21ms4408 KiB
22Accepted245ms5812 KiB
23Time limit exceeded3.081s5812 KiB
24Time limit exceeded3.082s5864 KiB
25Accepted79ms5808 KiB
26Accepted43ms3200 KiB
subtask40/24
27Accepted194ms33396 KiB
28Time limit exceeded3.084s3644 KiB
29Time limit exceeded3.085s35104 KiB
30Time limit exceeded3.085s35868 KiB
31Time limit exceeded3.088s35612 KiB
32Time limit exceeded3.076s35868 KiB
33Accepted1.246s3580 KiB
34Time limit exceeded3.078s35052 KiB
35Time limit exceeded3.089s35608 KiB
36Time limit exceeded3.078s35612 KiB
37Time limit exceeded3.082s35596 KiB
38Time limit exceeded3.082s35764 KiB
39Time limit exceeded3.085s3384 KiB
subtask50/22
40Accepted187ms33724 KiB
41Accepted846ms3120 KiB
42Accepted64ms13276 KiB
43Accepted163ms35288 KiB
44Time limit exceeded3.086s35856 KiB
45Time limit exceeded3.095s35352 KiB
46Accepted17ms3244 KiB
47Accepted17ms3128 KiB
48Accepted50ms11224 KiB
49Time limit exceeded3.088s33180 KiB
50Time limit exceeded3.065s35856 KiB
51Time limit exceeded3.082s35852 KiB
52Accepted2.226s35348 KiB
53Accepted43ms3128 KiB
subtask60/17
54Accepted229ms45488 KiB
55Time limit exceeded3.082s45516 KiB
56Accepted197ms45236 KiB
57Accepted196ms44980 KiB
58Time limit exceeded3.079s44488 KiB
59Time limit exceeded3.079s44492 KiB
60Accepted372ms45516 KiB
61Accepted214ms45512 KiB
62Accepted214ms44984 KiB
63Time limit exceeded3.088s44780 KiB
64Time limit exceeded3.084s44904 KiB
65Time limit exceeded3.084s44540 KiB
66Time limit exceeded3.084s26424 KiB