Submission #54142551


Source Code Expand

N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
dp = [False]*(1<<N)

for S in range(1<<N):
    l = []
    
    for i in range(N):
        if (S>>i)&1:
            l.append(i)
    
    for i in range(len(l)):
        for j in range(i+1, len(l)):
            Ai, Bi = AB[l[i]]
            Aj, Bj = AB[l[j]]
            T = S ^ (1<<l[i]) ^ (1<<l[j])
            
            if Ai == Aj and not dp[T]:
                dp[S] = True
                
            if Bi == Bj and not dp[T]:
                dp[S] = True

if dp[-1]:
    print('Takahashi')
else:
    print('Aoki')

Submission Info

Submission Time
Task E - Remove Pairs
User roaris_cp
Language Python (PyPy 3.10-v7.3.12)
Score 475
Code Size 624 Byte
Status AC
Exec Time 357 ms
Memory 85408 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 475 / 475
Status
AC × 2
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt, 02_hand_03.txt, 02_hand_04.txt, 02_hand_05.txt, 02_hand_06.txt, 02_hand_07.txt, 02_hand_08.txt, 02_hand_09.txt, 02_hand_10.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 56 ms 76324 KiB
00_sample_01.txt AC 67 ms 81620 KiB
01_random_00.txt AC 139 ms 83912 KiB
01_random_01.txt AC 76 ms 82144 KiB
01_random_02.txt AC 66 ms 81868 KiB
01_random_03.txt AC 57 ms 76364 KiB
01_random_04.txt AC 62 ms 81612 KiB
01_random_05.txt AC 76 ms 81772 KiB
01_random_06.txt AC 65 ms 81868 KiB
01_random_07.txt AC 357 ms 85244 KiB
01_random_08.txt AC 310 ms 85220 KiB
01_random_09.txt AC 76 ms 82616 KiB
01_random_10.txt AC 205 ms 84044 KiB
01_random_11.txt AC 56 ms 76348 KiB
01_random_12.txt AC 80 ms 82296 KiB
01_random_13.txt AC 63 ms 81988 KiB
01_random_14.txt AC 81 ms 82556 KiB
01_random_15.txt AC 83 ms 82664 KiB
01_random_16.txt AC 101 ms 83176 KiB
02_hand_00.txt AC 292 ms 84784 KiB
02_hand_01.txt AC 287 ms 85040 KiB
02_hand_02.txt AC 325 ms 85324 KiB
02_hand_03.txt AC 311 ms 85296 KiB
02_hand_04.txt AC 314 ms 85328 KiB
02_hand_05.txt AC 330 ms 85408 KiB
02_hand_06.txt AC 306 ms 85240 KiB
02_hand_07.txt AC 343 ms 85040 KiB
02_hand_08.txt AC 357 ms 85228 KiB
02_hand_09.txt AC 355 ms 85200 KiB
02_hand_10.txt AC 354 ms 85240 KiB