Submission #23941220
Source Code Expand
import sys
input = sys.stdin.readline
def fill_grundy():
grundy = [[0 for j in range(1500)] for i in range(51)]
for i in range(51):
for j in range(1440):
exist = [False for _ in range(800)]
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 | PyPy3 (7.3.0) |
| Score | 6 |
| Code Size | 852 Byte |
| Status | AC |
| Exec Time | 671 ms |
| Memory | 97732 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 6 / 6 | ||||
| Status |
|
|
| 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 | 626 ms | 75488 KiB |
| Hand_2.txt | AC | 597 ms | 75560 KiB |
| Hand_3.txt | AC | 588 ms | 75956 KiB |
| Max_Random_01.txt | AC | 648 ms | 97396 KiB |
| Max_Random_02.txt | AC | 605 ms | 97436 KiB |
| Max_Random_03.txt | AC | 618 ms | 97392 KiB |
| Max_Random_04.txt | AC | 611 ms | 97396 KiB |
| Max_Random_05.txt | AC | 617 ms | 97120 KiB |
| Max_Random_06.txt | AC | 617 ms | 97152 KiB |
| Max_Random_07.txt | AC | 619 ms | 97108 KiB |
| Max_Random_08.txt | AC | 619 ms | 97732 KiB |
| Max_Random_09.txt | AC | 671 ms | 97532 KiB |
| Max_Random_10.txt | AC | 653 ms | 97252 KiB |
| Random_01.txt | AC | 611 ms | 76000 KiB |
| Random_02.txt | AC | 618 ms | 81316 KiB |
| Random_03.txt | AC | 591 ms | 76676 KiB |
| Random_04.txt | AC | 607 ms | 92316 KiB |
| Random_05.txt | AC | 599 ms | 75640 KiB |
| Random_06.txt | AC | 598 ms | 87520 KiB |
| Random_07.txt | AC | 606 ms | 78032 KiB |
| Random_08.txt | AC | 591 ms | 77104 KiB |
| Random_09.txt | AC | 621 ms | 89196 KiB |
| Random_10.txt | AC | 600 ms | 78184 KiB |
| Sample_1.txt | AC | 584 ms | 75520 KiB |
| Sample_2.txt | AC | 611 ms | 75356 KiB |
| Sample_3.txt | AC | 594 ms | 75624 KiB |
| Sample_4.txt | AC | 602 ms | 75408 KiB |
| Sample_5.txt | AC | 592 ms | 75556 KiB |
| Second_01.txt | AC | 597 ms | 80232 KiB |
| Second_02.txt | AC | 617 ms | 88388 KiB |
| Second_03.txt | AC | 623 ms | 86704 KiB |
| Second_04.txt | AC | 600 ms | 80344 KiB |
| Second_05.txt | AC | 608 ms | 89020 KiB |
| Second_06.txt | AC | 618 ms | 92784 KiB |
| Second_07.txt | AC | 601 ms | 83500 KiB |
| Second_08.txt | AC | 599 ms | 83892 KiB |
| Second_09.txt | AC | 604 ms | 88936 KiB |
| Second_10.txt | AC | 605 ms | 88908 KiB |