結果
問題 | No.977 アリス仕掛けの摩天楼 |
ユーザー | GrayCoder |
提出日時 | 2020-01-31 22:27:20 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 11,880 KB |
実行使用メモリ | 105,152 KB |
最終ジャッジ日時 | 2023-10-17 10:35:30 |
合計ジャッジ時間 | 25,718 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 749 ms
51,116 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 747 ms
51,120 KB |
testcase_07 | AC | 740 ms
51,128 KB |
testcase_08 | AC | 748 ms
51,124 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 761 ms
52,600 KB |
testcase_15 | AC | 759 ms
52,600 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 839 ms
60,256 KB |
testcase_21 | AC | 909 ms
66,352 KB |
testcase_22 | AC | 936 ms
70,484 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
ソースコード
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') if x == 2: if (0, N - 2) in UV or (1, N - 1) in UV: print('Bob') else: print('Alice') main()