結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー GrayCoderGrayCoder
提出日時 2020-01-31 22:17:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 11,920 KB
実行使用メモリ 109,936 KB
最終ジャッジ日時 2023-10-17 10:12:15
合計ジャッジ時間 25,755 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,175 ms
53,548 KB
testcase_01 AC 728 ms
53,696 KB
testcase_02 AC 723 ms
53,700 KB
testcase_03 AC 724 ms
53,696 KB
testcase_04 AC 719 ms
53,696 KB
testcase_05 AC 731 ms
53,700 KB
testcase_06 AC 720 ms
53,700 KB
testcase_07 AC 722 ms
53,708 KB
testcase_08 AC 717 ms
53,708 KB
testcase_09 AC 725 ms
53,872 KB
testcase_10 WA -
testcase_11 AC 739 ms
53,704 KB
testcase_12 AC 729 ms
53,708 KB
testcase_13 AC 751 ms
55,172 KB
testcase_14 AC 755 ms
55,172 KB
testcase_15 AC 775 ms
55,172 KB
testcase_16 AC 770 ms
55,172 KB
testcase_17 AC 756 ms
55,172 KB
testcase_18 AC 792 ms
57,208 KB
testcase_19 WA -
testcase_20 AC 823 ms
60,088 KB
testcase_21 AC 892 ms
66,220 KB
testcase_22 AC 936 ms
70,928 KB
testcase_23 AC 951 ms
71,912 KB
testcase_24 AC 949 ms
71,876 KB
testcase_25 AC 950 ms
109,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    UV = [tuple(map(int, input().split())) for _ in [0] * (N - 1)]

    l = list(zip(*UV))
    d = [1] * len(UV)
    a = csr_matrix((d, (l[0], l[1])), (N, N))
    x = connected_components(a, return_labels=0)
    if x == 1:
        print('Bob')
    else:
        print('Alice')


main()
0