115642024-10-26 22:55:43balintPac-Manpypy3Time limit exceeded 18/1003.108s64200 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
1Accepted65ms36552 KiB
2Accepted68ms33300 KiB
3Accepted65ms37808 KiB
subtask218/18
4Accepted46ms19644 KiB
5Accepted46ms19644 KiB
6Accepted178ms25296 KiB
7Accepted122ms24256 KiB
8Accepted116ms22540 KiB
9Accepted46ms19644 KiB
10Accepted114ms22344 KiB
11Accepted119ms22600 KiB
12Accepted52ms21232 KiB
13Accepted70ms21704 KiB
subtask30/19
14Accepted59ms23272 KiB
15Accepted470ms22624 KiB
16Accepted64ms23024 KiB
17Accepted566ms24800 KiB
18Time limit exceeded3.084s26128 KiB
19Time limit exceeded3.104s26600 KiB
20Accepted79ms21992 KiB
21Accepted64ms22512 KiB
22Accepted377ms24468 KiB
23Accepted2.756s25324 KiB
24Time limit exceeded3.088s25836 KiB
25Accepted177ms24824 KiB
26Accepted64ms21740 KiB
subtask40/24
27Accepted172ms60992 KiB
28Time limit exceeded3.076s23380 KiB
29Time limit exceeded3.079s62604 KiB
30Time limit exceeded3.079s62780 KiB
31Time limit exceeded3.094s62708 KiB
32Time limit exceeded3.088s62580 KiB
33Accepted243ms22764 KiB
34Time limit exceeded3.108s62780 KiB
35Time limit exceeded3.088s62636 KiB
36Time limit exceeded3.086s62636 KiB
37Time limit exceeded3.098s62660 KiB
38Time limit exceeded3.108s62772 KiB
39Time limit exceeded3.086s22508 KiB
subtask50/22
40Accepted199ms61584 KiB
41Accepted536ms22692 KiB
42Accepted174ms32036 KiB
43Accepted190ms60568 KiB
44Time limit exceeded3.095s62344 KiB
45Time limit exceeded3.108s62884 KiB
46Accepted71ms22116 KiB
47Accepted61ms21996 KiB
48Accepted597ms28772 KiB
49Time limit exceeded3.088s56012 KiB
50Accepted1.615s62128 KiB
51Time limit exceeded3.091s62524 KiB
52Accepted1.378s62492 KiB
53Accepted105ms21744 KiB
subtask60/17
54Accepted175ms64200 KiB
55Time limit exceeded3.092s63536 KiB
56Accepted212ms63472 KiB
57Accepted215ms63700 KiB
58Time limit exceeded3.092s63272 KiB
59Time limit exceeded3.108s63384 KiB
60Accepted536ms63668 KiB
61Accepted209ms63564 KiB
62Accepted214ms63280 KiB
63Time limit exceeded3.096s63788 KiB
64Time limit exceeded3.091s63792 KiB
65Accepted833ms62768 KiB
66Time limit exceeded3.107s62060 KiB