44442023-03-28 09:38:22PallanekPéterÁtvágás (75 pont)python3Accepted 75/75521ms16768 KiB
N=int(input())
foksz=[0]*N
for i in range(N-1):
    a,b=[int(i) for i in input().split()]
    foksz[a-1]+=1
    foksz[b-1]+=1
db=0; mxfok=0
for i in range(N):
    if foksz[i]>2:
        db+=foksz[i]-2
    if mxfok<foksz[i]:
        mxfok=foksz[i]
print(db,N-mxfok-1)
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms11068 KiB
2Accepted0/017ms11416 KiB
3Accepted0/041ms11616 KiB
4Accepted4/417ms11324 KiB
5Accepted4/417ms11772 KiB
6Accepted4/417ms11856 KiB
7Accepted4/417ms12116 KiB
8Accepted4/417ms12376 KiB
9Accepted4/417ms12544 KiB
10Accepted4/4514ms15416 KiB
11Accepted4/4497ms15340 KiB
12Accepted4/4508ms15616 KiB
13Accepted4/4490ms15576 KiB
14Accepted4/4500ms15488 KiB
15Accepted4/4521ms15912 KiB
16Accepted4/4514ms15768 KiB
17Accepted4/4515ms15976 KiB
18Accepted5/5504ms16328 KiB
19Accepted6/6508ms16412 KiB
20Accepted6/6500ms16768 KiB
21Accepted2/217ms13628 KiB