結果

問題 No.1424 Ultrapalindrome
ユーザー tailstails
提出日時 2021-03-12 21:37:45
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 162,048 KB
実行使用メモリ 17,664 KB
最終ジャッジ日時 2023-09-19 02:15:07
合計ジャッジ時間 6,768 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,460 KB
testcase_01 AC 2 ms
7,464 KB
testcase_02 AC 3 ms
7,424 KB
testcase_03 AC 3 ms
7,368 KB
testcase_04 AC 2 ms
7,388 KB
testcase_05 AC 2 ms
7,636 KB
testcase_06 AC 3 ms
7,404 KB
testcase_07 WA -
testcase_08 AC 3 ms
7,464 KB
testcase_09 AC 11 ms
10,924 KB
testcase_10 AC 12 ms
11,008 KB
testcase_11 AC 9 ms
8,364 KB
testcase_12 AC 11 ms
11,012 KB
testcase_13 AC 4 ms
7,712 KB
testcase_14 AC 9 ms
8,596 KB
testcase_15 AC 2 ms
7,464 KB
testcase_16 AC 7 ms
8,220 KB
testcase_17 AC 9 ms
8,416 KB
testcase_18 AC 5 ms
8,120 KB
testcase_19 AC 9 ms
8,436 KB
testcase_20 AC 4 ms
7,600 KB
testcase_21 AC 8 ms
8,328 KB
testcase_22 AC 5 ms
7,768 KB
testcase_23 AC 3 ms
7,448 KB
testcase_24 AC 4 ms
7,732 KB
testcase_25 AC 4 ms
7,596 KB
testcase_26 AC 11 ms
10,752 KB
testcase_27 AC 12 ms
11,304 KB
testcase_28 AC 13 ms
17,664 KB
testcase_29 AC 14 ms
17,640 KB
testcase_30 AC 7 ms
11,120 KB
testcase_31 AC 9 ms
11,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

graph g;
int n,a[1d5],b[1d5],c[1d5];

void no(){
	wt("No");
	exit(0);
}

void f(int i,int p,int d){
	c[i]=d;
	rep[g.edge[i]](j,g.es[i]){
		if(j!=p){
			f(j,i,d+1);
		}
	}
}

{
	rd(n,(a--,b--)(n-1));
	g.setEdge(n,n-1,a,b);
	int r=0;
	while(g.es[r]!=1)++r;
	f(r,r,0);
	int e=0;
	rep(i,r+1,n){
		if(g.es[i]==1){
			if(e==0){
				e=c[i];
			}else{
				if(c[i]!=e){
					no();
				}
			}
		}
	}
	rep(i,r+1,n){
		if(g.es[i]>2){
			if(c[i]*2!=e){
				no();
			}
		}
	}
	wt("Yes");
}
0