結果

問題 No.2664 Prime Sum
ユーザー ntudantuda
提出日時 2024-03-09 00:13:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 72,852 KB
最終ジャッジ日時 2024-03-09 00:13:54
合計ジャッジ時間 3,703 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,332 KB
testcase_01 AC 37 ms
53,332 KB
testcase_02 AC 37 ms
53,332 KB
testcase_03 AC 38 ms
53,332 KB
testcase_04 AC 37 ms
53,332 KB
testcase_05 AC 54 ms
63,748 KB
testcase_06 AC 52 ms
63,784 KB
testcase_07 AC 41 ms
53,332 KB
testcase_08 AC 48 ms
60,884 KB
testcase_09 AC 55 ms
63,748 KB
testcase_10 AC 50 ms
61,396 KB
testcase_11 AC 39 ms
53,332 KB
testcase_12 AC 44 ms
55,468 KB
testcase_13 AC 53 ms
63,748 KB
testcase_14 AC 67 ms
70,836 KB
testcase_15 AC 67 ms
70,812 KB
testcase_16 AC 67 ms
70,836 KB
testcase_17 WA -
testcase_18 AC 54 ms
63,748 KB
testcase_19 AC 57 ms
63,748 KB
testcase_20 AC 67 ms
70,836 KB
testcase_21 AC 68 ms
70,796 KB
testcase_22 AC 53 ms
63,756 KB
testcase_23 AC 70 ms
70,784 KB
testcase_24 AC 70 ms
72,852 KB
testcase_25 AC 67 ms
70,792 KB
testcase_26 AC 39 ms
53,332 KB
testcase_27 AC 41 ms
53,332 KB
testcase_28 AC 39 ms
53,332 KB
testcase_29 AC 39 ms
53,332 KB
testcase_30 AC 38 ms
53,332 KB
testcase_31 AC 38 ms
53,332 KB
testcase_32 AC 40 ms
53,332 KB
testcase_33 AC 41 ms
53,332 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 37 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
E = [[] for _ in range(N)]
for a,b in AB:
    E[a-1].append(b-1)
    E[b-1].append(a-1)
C = [-1] * N
C[0] = 0
def bfs(x):
    for y in E[x]:
        if C[y] == C[x]:
            print("No")
            exit()
        if C[y] == -1:
            C[y] = C[x] ^ 1
            bfs(y)


bfs(0)
print("Yes")

0