結果

問題 No.583 鉄道同好会
ユーザー GrayCoder
提出日時 2017-10-28 00:51:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 27,420 KB
最終ジャッジ日時 2024-11-22 00:07:13
合計ジャッジ時間 3,410 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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