結果
問題 | No.1424 Ultrapalindrome |
ユーザー | titia |
提出日時 | 2021-03-12 21:35:23 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 32,000 KB |
最終ジャッジ日時 | 2024-04-22 12:22:40 |
合計ジャッジ時間 | 7,180 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
10,752 KB |
testcase_01 | AC | 31 ms
10,752 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 35 ms
10,752 KB |
testcase_05 | AC | 30 ms
10,752 KB |
testcase_06 | WA | - |
testcase_07 | AC | 30 ms
10,752 KB |
testcase_08 | AC | 31 ms
10,752 KB |
testcase_09 | AC | 350 ms
24,832 KB |
testcase_10 | AC | 358 ms
24,832 KB |
testcase_11 | AC | 243 ms
20,864 KB |
testcase_12 | AC | 334 ms
24,192 KB |
testcase_13 | AC | 103 ms
14,592 KB |
testcase_14 | AC | 275 ms
21,632 KB |
testcase_15 | AC | 31 ms
10,752 KB |
testcase_16 | AC | 223 ms
19,456 KB |
testcase_17 | AC | 251 ms
21,120 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 52 ms
12,032 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 451 ms
29,568 KB |
testcase_28 | WA | - |
testcase_29 | AC | 311 ms
31,872 KB |
testcase_30 | AC | 316 ms
27,392 KB |
testcase_31 | AC | 320 ms
30,592 KB |
ソースコード
import sys input = sys.stdin.readline N=int(input()) E=[[] for i in range(N)] ED=[0]*N for i in range(N-1): x,y=map(int,input().split()) E[x-1].append(y-1) E[y-1].append(x-1) ED[x-1]+=1 ED[y-1]+=1 for i in range(N): if ED[i]==1: Q=[i] break L=[0]*N while Q: x=Q.pop() for to in E[x]: if L[to]==0: L[to]=L[x]+1 Q.append(to) flag=1 MAX=max(L) for i in range(N): if ED[i]==1: if L[i]==MAX: True else: print("No") break else: print("Yes")