結果

問題 No.2427 Tree Distance Two
ユーザー titiatitia
提出日時 2023-08-27 03:15:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,927 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 1,725 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 61,780 KB
最終ジャッジ日時 2023-08-27 03:16:43
合計ジャッジ時間 35,570 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,944 KB
testcase_01 AC 16 ms
7,900 KB
testcase_02 AC 16 ms
7,880 KB
testcase_03 AC 1,927 ms
58,664 KB
testcase_04 AC 15 ms
7,780 KB
testcase_05 AC 1,906 ms
58,572 KB
testcase_06 AC 15 ms
7,936 KB
testcase_07 AC 1,718 ms
60,000 KB
testcase_08 AC 1,760 ms
61,464 KB
testcase_09 AC 1,711 ms
60,632 KB
testcase_10 AC 1,745 ms
61,780 KB
testcase_11 AC 1,702 ms
59,636 KB
testcase_12 AC 1,776 ms
59,332 KB
testcase_13 AC 1,777 ms
58,940 KB
testcase_14 AC 1,338 ms
57,696 KB
testcase_15 AC 15 ms
7,844 KB
testcase_16 AC 17 ms
7,824 KB
testcase_17 AC 16 ms
7,888 KB
testcase_18 AC 16 ms
7,956 KB
testcase_19 AC 16 ms
7,784 KB
testcase_20 AC 53 ms
9,760 KB
testcase_21 AC 60 ms
9,992 KB
testcase_22 AC 26 ms
8,480 KB
testcase_23 AC 22 ms
8,392 KB
testcase_24 AC 54 ms
9,756 KB
testcase_25 AC 454 ms
21,520 KB
testcase_26 AC 1,175 ms
39,568 KB
testcase_27 AC 832 ms
30,748 KB
testcase_28 AC 1,740 ms
54,760 KB
testcase_29 AC 1,556 ms
49,340 KB
testcase_30 AC 1,130 ms
38,536 KB
testcase_31 AC 704 ms
27,924 KB
testcase_32 AC 1,121 ms
38,052 KB
testcase_33 AC 983 ms
34,768 KB
testcase_34 AC 288 ms
16,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
E=[[] for i in range(N)]

for i in range(N-1):
    u,v=map(int,input().split())
    u-=1
    v-=1
    E[u].append(v)
    E[v].append(u)

for i in range(N):
    ANS=0
    for to in E[i]:
        ANS+=len(E[to])-1
    print(ANS)
0