結果

問題 No.583 鉄道同好会
ユーザー uafr_cs
提出日時 2017-11-03 21:44:45
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 2,255 ms
コンパイル使用メモリ 75,136 KB
実行使用メモリ 54,120 KB
最終ジャッジ日時 2024-11-22 15:48:56
合計ジャッジ時間 9,763 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final int M = sc.nextInt();
		
		int[] degs = new int[N];
		for(int i = 0; i < M; i++){
			final int a = sc.nextInt();
			final int b = sc.nextInt();
			
			degs[a]++;
			degs[b]++;
		}
		
		int odd_count = 0;
		for(int i = 0; i < N; i++){
			if(degs[i] % 2 == 1){ odd_count++; }
		}
		
		if(odd_count == 0 || odd_count == 2){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}
0