結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,332 KB
testcase_01 AC 75 ms
71,572 KB
testcase_02 AC 75 ms
71,612 KB
testcase_03 WA -
testcase_04 AC 75 ms
71,160 KB
testcase_05 AC 76 ms
71,404 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 77 ms
71,644 KB
testcase_09 AC 77 ms
71,396 KB
testcase_10 AC 73 ms
71,464 KB
testcase_11 WA -
testcase_12 AC 76 ms
71,376 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
    print(p+q+3)
0