結果

問題 No.946 箱箱箱
ユーザー mkawa2mkawa2
提出日時 2019-12-13 21:44:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 799 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 8,876 KB
最終ジャッジ日時 2023-09-09 23:09:09
合計ジャッジ時間 16,827 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,632 KB
testcase_01 AC 19 ms
8,560 KB
testcase_02 AC 19 ms
8,528 KB
testcase_03 AC 338 ms
8,704 KB
testcase_04 AC 372 ms
8,844 KB
testcase_05 AC 18 ms
8,620 KB
testcase_06 AC 373 ms
8,672 KB
testcase_07 AC 359 ms
8,852 KB
testcase_08 AC 372 ms
8,828 KB
testcase_09 AC 261 ms
8,808 KB
testcase_10 AC 336 ms
8,876 KB
testcase_11 AC 19 ms
8,500 KB
testcase_12 AC 244 ms
8,684 KB
testcase_13 AC 369 ms
8,840 KB
testcase_14 AC 363 ms
8,660 KB
testcase_15 AC 341 ms
8,804 KB
testcase_16 AC 334 ms
8,828 KB
testcase_17 AC 337 ms
8,792 KB
testcase_18 WA -
testcase_19 AC 324 ms
8,788 KB
testcase_20 AC 20 ms
8,684 KB
testcase_21 AC 289 ms
8,728 KB
testcase_22 AC 342 ms
8,752 KB
testcase_23 AC 367 ms
8,752 KB
testcase_24 AC 288 ms
8,860 KB
testcase_25 AC 317 ms
8,664 KB
testcase_26 AC 329 ms
8,800 KB
testcase_27 AC 337 ms
8,792 KB
testcase_28 AC 328 ms
8,784 KB
testcase_29 AC 367 ms
8,688 KB
testcase_30 AC 361 ms
8,820 KB
testcase_31 AC 364 ms
8,680 KB
testcase_32 AC 339 ms
8,828 KB
testcase_33 AC 348 ms
8,840 KB
testcase_34 AC 365 ms
8,776 KB
testcase_35 AC 365 ms
8,848 KB
testcase_36 AC 369 ms
8,820 KB
testcase_37 AC 372 ms
8,800 KB
testcase_38 AC 320 ms
8,704 KB
testcase_39 AC 338 ms
8,676 KB
testcase_40 WA -
testcase_41 AC 341 ms
8,696 KB
testcase_42 AC 345 ms
8,784 KB
testcase_43 AC 371 ms
8,796 KB
testcase_44 AC 316 ms
8,584 KB
testcase_45 AC 370 ms
8,740 KB
testcase_46 AC 370 ms
8,776 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 19 ms
8,724 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]^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