結果

問題 No.946 箱箱箱
ユーザー mkawa2mkawa2
提出日時 2019-12-13 21:47:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,135 ms / 2,000 ms
コード長 801 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 9,016 KB
最終ジャッジ日時 2023-09-09 23:12:08
合計ジャッジ時間 23,955 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,596 KB
testcase_01 AC 18 ms
8,608 KB
testcase_02 AC 19 ms
8,696 KB
testcase_03 AC 383 ms
8,736 KB
testcase_04 AC 413 ms
8,772 KB
testcase_05 AC 18 ms
8,552 KB
testcase_06 AC 408 ms
8,740 KB
testcase_07 AC 397 ms
8,884 KB
testcase_08 AC 425 ms
8,840 KB
testcase_09 AC 1,082 ms
8,900 KB
testcase_10 AC 378 ms
8,764 KB
testcase_11 AC 19 ms
8,700 KB
testcase_12 AC 1,135 ms
8,884 KB
testcase_13 AC 423 ms
8,712 KB
testcase_14 AC 402 ms
8,872 KB
testcase_15 AC 380 ms
8,800 KB
testcase_16 AC 375 ms
8,876 KB
testcase_17 AC 376 ms
8,872 KB
testcase_18 AC 408 ms
8,716 KB
testcase_19 AC 896 ms
8,972 KB
testcase_20 AC 20 ms
8,688 KB
testcase_21 AC 768 ms
8,980 KB
testcase_22 AC 384 ms
8,712 KB
testcase_23 AC 405 ms
8,856 KB
testcase_24 AC 768 ms
8,920 KB
testcase_25 AC 1,040 ms
9,016 KB
testcase_26 AC 370 ms
8,700 KB
testcase_27 AC 382 ms
8,868 KB
testcase_28 AC 371 ms
8,804 KB
testcase_29 AC 415 ms
8,752 KB
testcase_30 AC 405 ms
8,796 KB
testcase_31 AC 406 ms
8,720 KB
testcase_32 AC 380 ms
8,788 KB
testcase_33 AC 386 ms
8,704 KB
testcase_34 AC 410 ms
8,804 KB
testcase_35 AC 404 ms
8,872 KB
testcase_36 AC 413 ms
8,880 KB
testcase_37 AC 411 ms
8,880 KB
testcase_38 AC 1,042 ms
8,928 KB
testcase_39 AC 378 ms
8,856 KB
testcase_40 AC 793 ms
8,796 KB
testcase_41 AC 383 ms
8,888 KB
testcase_42 AC 385 ms
8,856 KB
testcase_43 AC 413 ms
8,748 KB
testcase_44 AC 1,038 ms
8,968 KB
testcase_45 AC 408 ms
8,736 KB
testcase_46 AC 415 ms
8,796 KB
testcase_47 AC 18 ms
8,668 KB
testcase_48 AC 17 ms
8,656 KB
testcase_49 AC 17 ms
8,648 KB
testcase_50 AC 18 ms
8,728 KB
testcase_51 AC 17 ms
8,544 KB
testcase_52 AC 18 ms
8,648 KB
testcase_53 AC 18 ms
8,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    aa=[int(input()) for _ in range(n)]
    grundy=[0]*(n+1)
    for i in range(n-1,-1,-1):
        hp=[]
        s=0
        for j in range(i,n):
            s^=aa[j]
            heappush(hp,grundy[j+1]^s)
        g=-1
        while hp:
            ng=heappop(hp)
            if ng!=g+1:break
            g=ng
        grundy[i]=g+1
    if grundy[0]:print("Takahashi")
    else:print("Takanashi")
    #print(grundy)

main()
0