結果

問題 No.946 箱箱箱
ユーザー 37zigen37zigen
提出日時 2019-12-10 03:42:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 895 bytes
コンパイル時間 3,105 ms
コンパイル使用メモリ 74,096 KB
実行使用メモリ 59,360 KB
最終ジャッジ日時 2023-09-09 10:17:31
合計ジャッジ時間 15,653 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,128 KB
testcase_01 AC 121 ms
56,012 KB
testcase_02 AC 122 ms
56,076 KB
testcase_03 AC 237 ms
58,800 KB
testcase_04 AC 236 ms
58,536 KB
testcase_05 AC 122 ms
56,212 KB
testcase_06 AC 237 ms
58,652 KB
testcase_07 AC 236 ms
59,084 KB
testcase_08 AC 235 ms
58,780 KB
testcase_09 AC 250 ms
57,836 KB
testcase_10 AC 238 ms
57,368 KB
testcase_11 AC 127 ms
55,828 KB
testcase_12 AC 250 ms
59,316 KB
testcase_13 AC 236 ms
58,840 KB
testcase_14 AC 236 ms
59,020 KB
testcase_15 AC 236 ms
58,964 KB
testcase_16 AC 233 ms
58,892 KB
testcase_17 AC 235 ms
59,360 KB
testcase_18 AC 248 ms
58,720 KB
testcase_19 AC 244 ms
58,780 KB
testcase_20 AC 133 ms
55,820 KB
testcase_21 AC 247 ms
58,432 KB
testcase_22 AC 236 ms
58,636 KB
testcase_23 AC 239 ms
59,240 KB
testcase_24 AC 244 ms
58,728 KB
testcase_25 AC 231 ms
58,628 KB
testcase_26 AC 231 ms
58,880 KB
testcase_27 AC 235 ms
59,024 KB
testcase_28 AC 234 ms
58,712 KB
testcase_29 AC 235 ms
59,108 KB
testcase_30 AC 244 ms
58,348 KB
testcase_31 AC 253 ms
59,320 KB
testcase_32 AC 234 ms
58,508 KB
testcase_33 AC 235 ms
58,860 KB
testcase_34 AC 238 ms
59,288 KB
testcase_35 AC 240 ms
58,964 KB
testcase_36 AC 238 ms
58,536 KB
testcase_37 AC 230 ms
58,564 KB
testcase_38 AC 221 ms
58,792 KB
testcase_39 AC 248 ms
58,884 KB
testcase_40 AC 241 ms
58,308 KB
testcase_41 AC 237 ms
59,132 KB
testcase_42 AC 236 ms
58,888 KB
testcase_43 AC 239 ms
58,548 KB
testcase_44 AC 232 ms
58,620 KB
testcase_45 AC 237 ms
58,444 KB
testcase_46 AC 240 ms
58,344 KB
testcase_47 AC 117 ms
55,620 KB
testcase_48 AC 124 ms
55,616 KB
testcase_49 AC 120 ms
55,476 KB
testcase_50 AC 122 ms
57,708 KB
testcase_51 AC 121 ms
56,228 KB
testcase_52 AC 121 ms
55,916 KB
testcase_53 AC 121 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
class Main
{

	public static void main(String[] args)
	{
		new Main().run();
	}

	void run(){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long[] A=new long[N];
		int[] g=new int[N+1];
		int[] G=new int[N+1];
		Arrays.fill(G,-1);
		G[N]=0;
		for(int i=0;i<N;++i){
			A[i]=sc.nextLong();
		}
		int[] p=new int[N+2];
		Arrays.fill(p,-1);
		//G[i]:=A[i]...A[N-1]が残っているときのgrundy
		for(int i=N;i>=1;--i){
			g[i]^=G[i];
			for(int j=i;j<=N;++j){
				g[j]^=A[i-1];
				p[Math.min(g[j],N+1)]=i;
			}
			//G[i-1]を決定する。
			for(int j=0;j<=p.length;++j){
				if(p[j]!=i){
					G[i-1]=j;
					break;
				}
			}
		}
		if(G[0]!=0){
			System.out.println("Takahashi");
		}else{
			System.out.println("Takanashi");
		}
	}

	void tr(Object...objects){
		System.out.println(Arrays.deepToString(objects));
	}
}
0