結果

問題 No.1424 Ultrapalindrome
ユーザー tailstails
提出日時 2021-03-12 21:38:56
言語 cLay
(20240104-1)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 161,744 KB
実行使用メモリ 17,544 KB
最終ジャッジ日時 2023-09-19 02:15:30
合計ジャッジ時間 3,820 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,376 KB
testcase_01 AC 2 ms
7,460 KB
testcase_02 AC 3 ms
7,380 KB
testcase_03 AC 2 ms
7,444 KB
testcase_04 AC 3 ms
7,620 KB
testcase_05 AC 3 ms
7,432 KB
testcase_06 AC 2 ms
7,580 KB
testcase_07 AC 2 ms
7,376 KB
testcase_08 AC 2 ms
7,404 KB
testcase_09 AC 11 ms
10,940 KB
testcase_10 AC 11 ms
11,056 KB
testcase_11 AC 8 ms
8,392 KB
testcase_12 AC 11 ms
10,856 KB
testcase_13 AC 4 ms
7,648 KB
testcase_14 AC 9 ms
8,652 KB
testcase_15 AC 2 ms
7,376 KB
testcase_16 AC 7 ms
8,164 KB
testcase_17 AC 8 ms
8,384 KB
testcase_18 AC 6 ms
7,948 KB
testcase_19 AC 9 ms
8,416 KB
testcase_20 AC 4 ms
7,772 KB
testcase_21 AC 8 ms
8,324 KB
testcase_22 AC 5 ms
7,748 KB
testcase_23 AC 2 ms
7,452 KB
testcase_24 AC 4 ms
7,604 KB
testcase_25 AC 4 ms
7,684 KB
testcase_26 AC 11 ms
10,784 KB
testcase_27 AC 12 ms
11,336 KB
testcase_28 AC 12 ms
17,544 KB
testcase_29 AC 13 ms
17,520 KB
testcase_30 AC 7 ms
11,060 KB
testcase_31 AC 8 ms
11,276 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,n){
		if(g.es[i]>2){
			if(c[i]*2!=e){
				no();
			}
		}
	}
	wt("Yes");
}
0