提出 #56666314


ソースコード 拡げる

import sys

sys.setrecursionlimit(500000)


def dfs(u, p, tree):
    g = 0
    for v in tree[u]:
        if v != p:
            g ^= dfs(v, u, tree) + 1
    return g


def main():
    N = int(input())
    tree = [[] for _ in range(N)]
    for _ in range(N - 1):
        x, y = map(int, input().split())
        x -= 1
        y -= 1
        tree[x].append(y)
        tree[y].append(x)

    if dfs(0, -1, tree) != 0:
        print("Alice")
    else:
        print("Bob")


if __name__ == '__main__':
    main()

提出情報

提出日時
問題 D - Game on Tree
ユーザ MitI_7
言語 Python (CPython 3.11.4)
得点 1100
コード長 541 Byte
結果 AC
実行時間 212 ms
メモリ 46620 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 1100 / 1100
結果
AC × 4
AC × 43
セット名 テストケース
Sample sample1.txt, sample2.txt, sample3.txt, sample4.txt
All sample1.txt, sample2.txt, sample3.txt, sample4.txt, a1.txt, a10.txt, a11.txt, a12.txt, a13.txt, a14.txt, a15.txt, a16.txt, a17.txt, a18.txt, a19.txt, a2.txt, a20.txt, a21.txt, a22.txt, a23.txt, a24.txt, a25.txt, a26.txt, a27.txt, a28.txt, a29.txt, a3.txt, a30.txt, a4.txt, a5.txt, a6.txt, a7.txt, a8.txt, a9.txt, b1.txt, b2.txt, b3.txt, b4.txt, b5.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt
ケース名 結果 実行時間 メモリ
a1.txt AC 11 ms 8928 KiB
a10.txt AC 24 ms 11064 KiB
a11.txt AC 24 ms 11032 KiB
a12.txt AC 24 ms 11056 KiB
a13.txt AC 173 ms 25788 KiB
a14.txt AC 177 ms 25736 KiB
a15.txt AC 134 ms 22440 KiB
a16.txt AC 167 ms 26644 KiB
a17.txt AC 178 ms 26664 KiB
a18.txt AC 179 ms 26704 KiB
a19.txt AC 173 ms 29840 KiB
a2.txt AC 12 ms 9204 KiB
a20.txt AC 191 ms 30748 KiB
a21.txt AC 157 ms 26632 KiB
a22.txt AC 167 ms 25840 KiB
a23.txt AC 164 ms 25716 KiB
a24.txt AC 146 ms 22488 KiB
a25.txt AC 176 ms 26680 KiB
a26.txt AC 168 ms 26596 KiB
a27.txt AC 173 ms 26716 KiB
a28.txt AC 185 ms 29832 KiB
a29.txt AC 190 ms 30780 KiB
a3.txt AC 16 ms 9668 KiB
a30.txt AC 146 ms 26556 KiB
a4.txt AC 24 ms 10620 KiB
a5.txt AC 23 ms 10612 KiB
a6.txt AC 25 ms 10604 KiB
a7.txt AC 25 ms 10676 KiB
a8.txt AC 24 ms 10672 KiB
a9.txt AC 23 ms 10576 KiB
b1.txt AC 206 ms 46616 KiB
b2.txt AC 212 ms 36064 KiB
b3.txt AC 195 ms 46620 KiB
b4.txt AC 197 ms 36008 KiB
b5.txt AC 199 ms 36036 KiB
sample1.txt AC 10 ms 8472 KiB
sample2.txt AC 10 ms 8532 KiB
sample3.txt AC 9 ms 8528 KiB
sample4.txt AC 10 ms 8516 KiB