結果

問題 No.1777 万華鏡美術館
ユーザー wolgnikwolgnik
提出日時 2021-12-06 12:48:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 71,724 KB
最終ジャッジ日時 2023-09-21 15:09:20
合計ジャッジ時間 2,025 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,408 KB
testcase_01 AC 73 ms
71,300 KB
testcase_02 AC 72 ms
71,540 KB
testcase_03 WA -
testcase_04 AC 74 ms
71,556 KB
testcase_05 AC 74 ms
71,552 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 77 ms
71,380 KB
testcase_09 AC 77 ms
71,416 KB
testcase_10 AC 75 ms
71,472 KB
testcase_11 WA -
testcase_12 AC 72 ms
71,416 KB
権限があれば一括ダウンロードができます

ソースコード

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