結果

問題 No.583 鉄道同好会
ユーザー GrayCoderGrayCoder
提出日時 2017-10-28 00:51:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,424 KB
最終ジャッジ日時 2024-05-01 18:23:32
合計ジャッジ時間 3,773 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 28 ms
10,752 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 28 ms
10,752 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 128 ms
15,804 KB
testcase_12 AC 169 ms
17,012 KB
testcase_13 AC 170 ms
16,980 KB
testcase_14 AC 180 ms
17,044 KB
testcase_15 AC 215 ms
18,288 KB
testcase_16 AC 406 ms
25,196 KB
testcase_17 AC 487 ms
27,416 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M = map(int, input().split())
    T = {tuple(map(int, input().split())) for _ in [0] * M}

    if M == 1:
        print('YES')
        exit()

    station = [0] * N
    for a, b in T:
        station[a] += 1
        station[b] += 1

    cnt = tuple(filter(lambda n:n==2, station))
    if len(cnt) == M - 1:
        print('YES')
    else:
        print('NO')

main()
0