結果

問題 No.768 Tapris and Noel play the game on Treeone
ユーザー tailstails
提出日時 2018-12-16 00:38:40
言語 cLay
(20240420-1)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 1,838 ms
コンパイル使用メモリ 164,952 KB
実行使用メモリ 12,588 KB
最終ジャッジ日時 2023-09-19 00:15:18
合計ジャッジ時間 6,447 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,112 KB
testcase_01 AC 4 ms
7,080 KB
testcase_02 AC 4 ms
7,164 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
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]<2&&!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