結果

問題 No.2202 贅沢てりたまチキン
ユーザー mkawa2mkawa2
提出日時 2023-02-04 01:54:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,286 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 123,620 KB
最終ジャッジ日時 2023-09-15 22:28:43
合計ジャッジ時間 6,162 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,472 KB
testcase_01 AC 72 ms
71,124 KB
testcase_02 AC 73 ms
71,156 KB
testcase_03 AC 74 ms
71,476 KB
testcase_04 AC 73 ms
71,412 KB
testcase_05 AC 73 ms
71,460 KB
testcase_06 AC 74 ms
71,404 KB
testcase_07 AC 75 ms
71,328 KB
testcase_08 AC 73 ms
71,520 KB
testcase_09 AC 72 ms
71,368 KB
testcase_10 AC 78 ms
78,660 KB
testcase_11 AC 74 ms
71,312 KB
testcase_12 AC 73 ms
71,440 KB
testcase_13 AC 75 ms
71,520 KB
testcase_14 AC 212 ms
100,972 KB
testcase_15 AC 209 ms
100,956 KB
testcase_16 AC 223 ms
123,540 KB
testcase_17 AC 233 ms
123,620 KB
testcase_18 AC 160 ms
97,840 KB
testcase_19 AC 167 ms
100,812 KB
testcase_20 AC 222 ms
101,192 KB
testcase_21 AC 223 ms
101,292 KB
testcase_22 AC 164 ms
89,644 KB
testcase_23 AC 224 ms
89,524 KB
testcase_24 WA -
testcase_25 AC 340 ms
100,288 KB
testcase_26 AC 218 ms
101,264 KB
testcase_27 AC 205 ms
99,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

n,m=LI()
to=[[] for _ in range(n)]
for _ in range(m):
    u,v=LI1()
    to[u].append(v)
    to[v].append(u)

color=[-1]*n
for u in range(n):
    if color[u]==-1:
        ok=0
        color[u]=0
        st=[u]
        while st and ok==0:
            u=st.pop()
            for v in to[u]:
                if color[v]==-1:
                    color[v]=color[u]^1
                    st.append(v)
                elif color[v]==color[u]:
                    ok=1
                    break
        if ok==0:
            print("No")
            exit()

print("Yes")
0