Submission #23940893


Source Code Expand

import sys
import numpy as np
from numba import njit

input = sys.stdin.readline


@njit('int32[:, :]()', cache=True)
def fill_grundy():
    grundy = np.zeros((51, 1500), dtype=np.int32)
    for i in range(51):
        for j in range(1440):
            exist = np.zeros(800, dtype=np.bool8)
            if i > 0:
                exist[grundy[i - 1][j + i]] = True
            for k in range(1, j // 2 + 1):
                exist[grundy[i][j - k]] = True
            g = 0
            while True:
                if not exist[g]:
                    break
                g += 1
            grundy[i][j] = g

    return grundy[:, : 51]


def main():
    grundy = fill_grundy()
    _ = int(input())
    w = list(map(int, input().split()))
    b = list(map(int, input().split()))
    g = 0
    for i, j in zip(w, b):
        g ^= grundy[i, j]
    print('First' if g > 0 else 'Second')


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task 031 - VS AtCoder(★6)
User riantkb
Language Python (3.8.2)
Score 6
Code Size 922 Byte
Status AC
Exec Time 622 ms
Memory 114296 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 6 / 6
Status
AC × 5
AC × 38
Set Name Test Cases
Sample Sample_1.txt, Sample_2.txt, Sample_3.txt, Sample_4.txt, Sample_5.txt
All Hand_1.txt, Hand_2.txt, Hand_3.txt, Max_Random_01.txt, Max_Random_02.txt, Max_Random_03.txt, Max_Random_04.txt, Max_Random_05.txt, Max_Random_06.txt, Max_Random_07.txt, Max_Random_08.txt, Max_Random_09.txt, Max_Random_10.txt, Random_01.txt, Random_02.txt, Random_03.txt, Random_04.txt, Random_05.txt, Random_06.txt, Random_07.txt, Random_08.txt, Random_09.txt, Random_10.txt, Sample_1.txt, Sample_2.txt, Sample_3.txt, Sample_4.txt, Sample_5.txt, Second_01.txt, Second_02.txt, Second_03.txt, Second_04.txt, Second_05.txt, Second_06.txt, Second_07.txt, Second_08.txt, Second_09.txt, Second_10.txt
Case Name Status Exec Time Memory
Hand_1.txt AC 581 ms 106380 KiB
Hand_2.txt AC 552 ms 105664 KiB
Hand_3.txt AC 550 ms 105796 KiB
Max_Random_01.txt AC 609 ms 113732 KiB
Max_Random_02.txt AC 612 ms 113900 KiB
Max_Random_03.txt AC 617 ms 113872 KiB
Max_Random_04.txt AC 611 ms 113920 KiB
Max_Random_05.txt AC 606 ms 113632 KiB
Max_Random_06.txt AC 609 ms 113752 KiB
Max_Random_07.txt AC 613 ms 113216 KiB
Max_Random_08.txt AC 622 ms 113984 KiB
Max_Random_09.txt AC 616 ms 114296 KiB
Max_Random_10.txt AC 609 ms 113728 KiB
Random_01.txt AC 559 ms 107132 KiB
Random_02.txt AC 568 ms 108252 KiB
Random_03.txt AC 556 ms 107456 KiB
Random_04.txt AC 600 ms 112724 KiB
Random_05.txt AC 548 ms 106104 KiB
Random_06.txt AC 584 ms 110488 KiB
Random_07.txt AC 561 ms 107464 KiB
Random_08.txt AC 565 ms 106484 KiB
Random_09.txt AC 590 ms 111620 KiB
Random_10.txt AC 562 ms 108044 KiB
Sample_1.txt AC 547 ms 106488 KiB
Sample_2.txt AC 552 ms 105752 KiB
Sample_3.txt AC 551 ms 105848 KiB
Sample_4.txt AC 547 ms 106372 KiB
Sample_5.txt AC 554 ms 105836 KiB
Second_01.txt AC 575 ms 108124 KiB
Second_02.txt AC 595 ms 110928 KiB
Second_03.txt AC 579 ms 110404 KiB
Second_04.txt AC 564 ms 107816 KiB
Second_05.txt AC 588 ms 111336 KiB
Second_06.txt AC 605 ms 113712 KiB
Second_07.txt AC 573 ms 109396 KiB
Second_08.txt AC 581 ms 110056 KiB
Second_09.txt AC 592 ms 111180 KiB
Second_10.txt AC 589 ms 111500 KiB