結果

問題 No.1777 万華鏡美術館
ユーザー wolgnik
提出日時 2021-12-06 12:48:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 55,712 KB
最終ジャッジ日時 2024-07-07 08:54:49
合計ジャッジ時間 1,075 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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
    if p==q==0:p=1
    print(p+q+3)
0