Submission #20918129


Source Code Expand

N = int(input())

S = input()[::-1]
X = input()[::-1]
Judge = [False] * 7
Judge[0] = True

for i, (_s, x) in enumerate(zip(S, X)):
    s = int(_s)
    n = s * pow(10, i, 7) % 7
    J = [False] * 7
    if x == 'A':
        for j in range(7):
            J[j] = Judge[j] and Judge[(j + n) % 7]
    else:
        for j in range(7):
            J[j] = Judge[j] or Judge[(j + n) % 7]
    Judge = J
if Judge[0]:
    print('Takahashi')
else:
    print('Aoki')

Submission Info

Submission Time
Task E - Lucky 7 Battle
User hirofumi999
Language PyPy3 (7.3.0)
Score 500
Code Size 475 Byte
Status AC
Exec Time 204 ms
Memory 73928 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 4
AC × 37
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_31.txt, random_32.txt, random_33.txt, random_41.txt, random_42.txt, random_43.txt, random_44.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
hand_01.txt AC 204 ms 61220 KiB
hand_02.txt AC 51 ms 61464 KiB
hand_03.txt AC 50 ms 61156 KiB
hand_04.txt AC 49 ms 61468 KiB
random_01.txt AC 104 ms 73292 KiB
random_02.txt AC 99 ms 73652 KiB
random_03.txt AC 104 ms 73236 KiB
random_04.txt AC 94 ms 73312 KiB
random_05.txt AC 104 ms 73528 KiB
random_06.txt AC 85 ms 73508 KiB
random_11.txt AC 111 ms 73576 KiB
random_12.txt AC 98 ms 73524 KiB
random_13.txt AC 112 ms 73916 KiB
random_14.txt AC 105 ms 73384 KiB
random_15.txt AC 111 ms 73752 KiB
random_16.txt AC 91 ms 73180 KiB
random_17.txt AC 111 ms 73912 KiB
random_18.txt AC 92 ms 73376 KiB
random_19.txt AC 110 ms 73928 KiB
random_20.txt AC 97 ms 73276 KiB
random_21.txt AC 109 ms 73556 KiB
random_22.txt AC 110 ms 73752 KiB
random_23.txt AC 112 ms 73864 KiB
random_24.txt AC 101 ms 73616 KiB
random_25.txt AC 109 ms 73920 KiB
random_26.txt AC 90 ms 73464 KiB
random_31.txt AC 103 ms 73560 KiB
random_32.txt AC 102 ms 73364 KiB
random_33.txt AC 104 ms 73260 KiB
random_41.txt AC 93 ms 73228 KiB
random_42.txt AC 96 ms 73076 KiB
random_43.txt AC 95 ms 73348 KiB
random_44.txt AC 101 ms 73524 KiB
sample_01.txt AC 50 ms 61304 KiB
sample_02.txt AC 49 ms 61460 KiB
sample_03.txt AC 49 ms 61512 KiB
sample_04.txt AC 50 ms 61364 KiB