結果

問題 No.1563 Same Degree
ユーザー hiragn
提出日時 2022-11-05 06:09:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 765 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 64,212 KB
最終ジャッジ日時 2024-07-19 02:25:28
合計ジャッジ時間 6,206 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections


def main():
    t = int(input())

    for _ in range(t):
        n, m = map(int, input().split())
        if n == 1:
            print("No")
            continue

        d = collections.defaultdict(set)
        for _ in range(m):
            fr, to = map(int, input().split())
            d[fr].add(to)
            d[to].add(fr)

        lst = list(map(len, dict(d).values()))
        if len(set(lst)) != n:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()
0