結果

問題 No.946 箱箱箱
ユーザー maspy
提出日時 2020-03-31 16:35:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,852 KB
最終ジャッジ日時 2024-06-24 20:03:59
合計ジャッジ時間 35,260 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np
N, *A = map(int, read().split())

dp = np.zeros(N + 1, np.int32)
for i, x in enumerate(A[::-1]):
    dp[:i + 1] ^= x
    values = np.unique(dp[: i + 1])
    n = len(values)
    ind = np.where(np.arange(n) != values)[0]
    dp[i + 1] = n if not len(ind) else ind[0]

answer = 'Takanashi' if dp[0] else 'Takahashi'
print(answer)
0