結果

問題 No.1563 Same Degree
ユーザー moharan627moharan627
提出日時 2021-06-26 15:08:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 973 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 28,652 KB
最終ジャッジ日時 2023-09-07 16:53:20
合計ジャッジ時間 3,152 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,652 KB
testcase_01 AC 100 ms
8,596 KB
testcase_02 AC 97 ms
8,556 KB
testcase_03 AC 97 ms
8,692 KB
testcase_04 AC 102 ms
8,644 KB
testcase_05 AC 99 ms
8,720 KB
testcase_06 AC 104 ms
8,628 KB
testcase_07 AC 104 ms
8,560 KB
testcase_08 AC 103 ms
8,672 KB
testcase_09 AC 104 ms
8,760 KB
testcase_10 AC 103 ms
8,732 KB
testcase_11 AC 68 ms
17,900 KB
testcase_12 AC 106 ms
20,320 KB
testcase_13 AC 233 ms
27,296 KB
testcase_14 AC 256 ms
28,652 KB
testcase_15 AC 183 ms
24,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(10 ** 6)
INF = float('inf')
#10**20に変えるのもあり
MOD = 10**9 + 7
MOD2 = 998244353
def solve():
    def II(): return int(sys.stdin.readline())
    def LI(): return list(map(int, sys.stdin.readline().split()))
    def LC(): return list(input())
    def IC(): return [int(c) for c in input()]
    def MI(): return map(int, sys.stdin.readline().split())
    T = II()
    from collections import defaultdict
    for _ in range(T):
        N,M = MI()
        Graph = [[] for n in range(N + 1)]
        for m in range(M):
            u,v = MI()
            Graph[u].append(v)
            Graph[v].append(u)
        flag = True
        #print(Graph)
        Num = defaultdict(lambda: 0)
        for n in range(1,N+1):
            Num[len(Graph[n])] += 1
            if(Num[len(Graph[n])] >= 2):
                print("Yes")
                flag = False
                break
        if(flag):
            print("No")

    return
solve()
0