結果

問題 No.2726 Rooted Tree Nim
ユーザー tailstails
提出日時 2024-04-12 22:31:02
言語 cLay
(20240104-1)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 3,339 ms
コンパイル使用メモリ 177,756 KB
実行使用メモリ 21,232 KB
最終ジャッジ日時 2024-04-12 22:31:07
合計ジャッジ時間 5,241 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 14 ms
14,544 KB
testcase_02 AC 24 ms
13,328 KB
testcase_03 AC 54 ms
19,052 KB
testcase_04 AC 52 ms
21,232 KB
testcase_05 AC 23 ms
14,436 KB
testcase_06 AC 24 ms
14,956 KB
testcase_07 AC 29 ms
14,676 KB
testcase_08 AC 31 ms
14,628 KB
testcase_09 AC 21 ms
13,320 KB
testcase_10 AC 21 ms
13,056 KB
testcase_11 AC 21 ms
13,672 KB
testcase_12 AC 25 ms
14,360 KB
testcase_13 AC 37 ms
12,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int a[2d5],k;
graph g;
int f(int i,int p,int w){
	int x=w?a[i-1]%(k+1):0;
	rep[g.edge[i]](j,g.es[i]){
		if(j!=p){
			x^=f(j,i,!w);
		}
	}
	return x;
}
{
	ll@t;
	rep(t){
		int@n;
		rd(k);
		int@(x,y)[n-1];
		rd(a(n));
		g.setEdge(n+1,n-1,x,y);
		wt(f(1,1,0)?'K':'P');
	}
}
0