結果

問題 No.1777 万華鏡美術館
ユーザー wolgnikwolgnik
提出日時 2021-12-06 12:41:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 54,400 KB
最終ジャッジ日時 2024-07-07 08:54:24
合計ジャッジ時間 1,101 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
if m == 0:
    print(4+(n%2))
else:
    inc=[0]*(n+1)
    for _ in range(m):
        u,v =map(int,input().split())
        inc[u] += 1
        inc[v] += 1
    p=n%2
    if p==0:
        c=0
        for x in inc[1:]*2:
            if c>1: p=1
            if x: c=0
            else: c +=1
        
        
    q=0
    for x in inc:
        if x and x != 2: q=1
    print(p+q+3)
0