結果

問題 No.2202 贅沢てりたまチキン
ユーザー mkawa2mkawa2
提出日時 2023-02-03 21:35:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,296 bytes
コンパイル時間 1,218 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 125,168 KB
最終ジャッジ日時 2023-09-15 17:10:24
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,496 KB
testcase_01 AC 68 ms
71,456 KB
testcase_02 AC 68 ms
71,272 KB
testcase_03 AC 67 ms
71,496 KB
testcase_04 AC 69 ms
71,328 KB
testcase_05 AC 67 ms
71,212 KB
testcase_06 AC 68 ms
71,276 KB
testcase_07 AC 66 ms
71,228 KB
testcase_08 AC 68 ms
71,376 KB
testcase_09 AC 67 ms
71,264 KB
testcase_10 AC 80 ms
79,904 KB
testcase_11 AC 66 ms
71,224 KB
testcase_12 AC 68 ms
71,228 KB
testcase_13 AC 68 ms
71,524 KB
testcase_14 AC 215 ms
102,488 KB
testcase_15 AC 200 ms
102,596 KB
testcase_16 AC 211 ms
125,152 KB
testcase_17 AC 220 ms
125,168 KB
testcase_18 AC 151 ms
98,684 KB
testcase_19 AC 160 ms
102,408 KB
testcase_20 AC 207 ms
102,932 KB
testcase_21 AC 209 ms
102,988 KB
testcase_22 AC 152 ms
89,412 KB
testcase_23 AC 206 ms
89,384 KB
testcase_24 WA -
testcase_25 AC 313 ms
101,828 KB
testcase_26 AC 204 ms
102,872 KB
testcase_27 AC 196 ms
101,428 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)

fin=[0]*n
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