結果

問題 No.768 Tapris and Noel play the game on Treeone
ユーザー tailstails
提出日時 2018-12-16 00:53:29
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 165,028 KB
実行使用メモリ 12,584 KB
最終ジャッジ日時 2023-09-19 00:15:46
合計ジャッジ時間 3,947 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,784 KB
testcase_01 AC 3 ms
6,672 KB
testcase_02 AC 3 ms
6,656 KB
testcase_03 AC 4 ms
6,700 KB
testcase_04 AC 3 ms
6,744 KB
testcase_05 AC 3 ms
6,712 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 14 ms
8,528 KB
testcase_09 AC 16 ms
8,596 KB
testcase_10 AC 12 ms
8,132 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
20evil_special_uni1.txt WA -
20evil_special_uni2.txt WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

int n,a[2d5];
vector<int> v[1d5];
int g[1d5];
int h[1d5];
int m;

int f1(int b,int p){
	int r=0;
	for(int c:v[b]){
		if(c!=p&&!f1(c,b)){
			r+=1;
		}
	}
	return g[b]=r;
}

void f2(int b,int p,int d){
	for(int c:v[b]){
		if(c!=p){
			f2(c,b,!(g[b]-!g[c]||d));
		}
	}
	m+=h[b]=!(g[b]||d);
}

{
	rd(n,a(n*2-2));
	rep(i,n*2-2){
		v[a[i]-1].push_back(a[i^1]-1);
	}
	f1(0,-1);
	f2(0,-1,0);
	wt(m);
	rep(i,n*2-2){
		if(h[i]) wt(i+1);
	}
}
0