結果
問題 |
No.2638 Initial fare
|
ユーザー |
![]() |
提出日時 | 2024-02-19 23:21:11 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 518 bytes |
コンパイル時間 | 187 ms |
コンパイル使用メモリ | 82,128 KB |
実行使用メモリ | 267,168 KB |
最終ジャッジ日時 | 2024-09-29 03:03:45 |
合計ジャッジ時間 | 4,200 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 23 |
ソースコード
N = int(input()) X = [[] for a in range(N)] for a in range(N-1): u,v = map(int,input().split()) X[u-1].append(v-1) X[v-1].append(u-1) Ans = 0 for a in range(N): W = [False for a in range(N)] Z = [a] W[a] = True t = 0 while len(Z) >= 1 and t < 3: T = [] for x in Z: for y in X[x]: if not W[y]: T.append(y) W[y] = True Ans += 1 t += 1 Z = T.copy() print(Ans//2)