結果
| 問題 |
No.2403 "Eight" Bridges of Königsberg
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-04 22:27:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 331 bytes |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 81,152 KB |
| 最終ジャッジ日時 | 2024-10-14 20:27:23 |
| 合計ジャッジ時間 | 4,135 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | WA * 31 |
ソースコード
n,m = map(int,input().split())
graph=[[] for _ in range(n)]
for i in range(m):
a,b = map(int,input().split())
graph[a-1].append(b-1)
c1=0
c2=0
for i in range(n):
if len(graph[i])%2==1:
c1+=1
else:
c2+=1
if c1-2 > 0:
print(abs(c1-2))
elif c1-2 == 0 or c1 == 0:
print(0)
else:
print(-1)