結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,172 KB
testcase_01 AC 4 ms
7,056 KB
testcase_02 AC 3 ms
7,052 KB
testcase_03 AC 4 ms
7,088 KB
testcase_04 AC 4 ms
7,076 KB
testcase_05 AC 4 ms
7,076 KB
testcase_06 AC 4 ms
7,076 KB
testcase_07 WA -
testcase_08 AC 14 ms
8,576 KB
testcase_09 AC 15 ms
8,832 KB
testcase_10 AC 12 ms
8,404 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 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+=g[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(g[i]) wt(i+1);
	}
}
0