115622024-10-26 22:48:35balintPac-Manpython3Time limit exceeded 18/1003.101s45528 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
1Accepted17ms3124 KiB
2Accepted17ms3124 KiB
3Accepted16ms3128 KiB
subtask218/18
4Accepted17ms3128 KiB
5Accepted17ms3136 KiB
6Accepted159ms3128 KiB
7Accepted45ms3568 KiB
8Accepted35ms3212 KiB
9Accepted16ms3132 KiB
10Accepted45ms3128 KiB
11Accepted37ms3128 KiB
12Accepted16ms3128 KiB
13Accepted39ms3056 KiB
subtask30/19
14Accepted27ms5688 KiB
15Accepted691ms3120 KiB
16Accepted34ms5176 KiB
17Accepted35ms5680 KiB
18Time limit exceeded3.086s5688 KiB
19Time limit exceeded3.099s5696 KiB
20Accepted17ms3020 KiB
21Accepted23ms4240 KiB
22Accepted252ms5812 KiB
23Time limit exceeded3.082s5812 KiB
24Time limit exceeded3.088s5688 KiB
25Accepted79ms5688 KiB
26Accepted43ms3128 KiB
subtask40/24
27Accepted172ms33288 KiB
28Time limit exceeded3.086s3640 KiB
29Time limit exceeded3.088s35100 KiB
30Time limit exceeded3.088s35864 KiB
31Time limit exceeded3.089s35608 KiB
32Time limit exceeded3.089s35676 KiB
33Accepted1.235s3952 KiB
34Time limit exceeded3.092s34844 KiB
35Time limit exceeded3.084s35608 KiB
36Time limit exceeded3.082s35864 KiB
37Time limit exceeded3.082s35608 KiB
38Time limit exceeded3.084s35868 KiB
39Time limit exceeded3.085s3384 KiB
subtask50/22
40Accepted167ms33580 KiB
41Accepted850ms3072 KiB
42Accepted57ms13284 KiB
43Accepted180ms35292 KiB
44Time limit exceeded3.081s35856 KiB
45Time limit exceeded3.086s35344 KiB
46Accepted16ms3168 KiB
47Accepted16ms3076 KiB
48Accepted48ms11104 KiB
49Time limit exceeded3.088s33172 KiB
50Time limit exceeded3.091s35868 KiB
51Time limit exceeded3.085s35708 KiB
52Accepted2.269s35428 KiB
53Accepted45ms3132 KiB
subtask60/17
54Accepted231ms45476 KiB
55Time limit exceeded3.086s45528 KiB
56Accepted230ms45208 KiB
57Accepted194ms44972 KiB
58Time limit exceeded3.085s44624 KiB
59Time limit exceeded3.101s44496 KiB
60Accepted386ms45384 KiB
61Accepted211ms45512 KiB
62Accepted212ms44984 KiB
63Time limit exceeded3.091s44780 KiB
64Time limit exceeded3.088s44904 KiB
65Time limit exceeded3.091s44496 KiB
66Time limit exceeded3.101s26296 KiB