結果
| 問題 |
No.2532 Want Play More
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-11-07 02:02:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 915 ms / 2,000 ms |
| コード長 | 557 bytes |
| コンパイル時間 | 264 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 92,544 KB |
| 最終ジャッジ日時 | 2024-09-25 23:14:05 |
| 合計ジャッジ時間 | 12,618 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N=int(input())
E=[[] for i in range(N+1)]
for i in range(N-1):
a,b=map(int,input().split())
E[a].append(b)
E[b].append(a)
def calc(point,parent,minmax):
ANS=0
for to in E[point]:
if to==parent:
continue
if minmax==0:
if ANS==0:
ANS=1<<30
ANS=min(ANS,1+calc(to,point,minmax^1))
else:
ANS=max(ANS,1+calc(to,point,minmax^1))
return ANS
print(calc(1,-1,1))
print(calc(1,-1,0))
titia