Submission #26900118


Source Code Expand

n=int(input())
ab = []
for i in range(n-1):
    ab.append(list(map(int, input().split())))

# スター頂点特定
p1, p2 = ab[0]
q1, q2 = ab[1]

if p1==q1 or p1==q2 or p2==q1 or p2==q2:
    if p1==q1 or p1==q2:
        star = p1
    else:
        star = p2
    ans = "Yes"
    for j in ab:
        if j[0] != star and j[1] != star:
            ans = "No"
            break
    print(ans)
else:
    print("No")

Submission Info

Submission Time
Task B - Star or Not
User QmanEnobikto
Language Python (3.8.2)
Score 200
Code Size 432 Byte
Status AC
Exec Time 239 ms
Memory 27200 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 17 ms 9076 KiB
001.txt AC 239 ms 27088 KiB
002.txt AC 19 ms 9068 KiB
003.txt AC 225 ms 27200 KiB
004.txt AC 84 ms 14560 KiB
005.txt AC 58 ms 12052 KiB
006.txt AC 156 ms 21300 KiB
example0.txt AC 17 ms 9064 KiB
example1.txt AC 17 ms 9016 KiB
example2.txt AC 21 ms 9076 KiB