結果

問題 No.583 鉄道同好会
ユーザー uafr_csuafr_cs
提出日時 2017-11-03 22:08:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 644 bytes
コンパイル時間 2,399 ms
コンパイル使用メモリ 75,876 KB
実行使用メモリ 53,640 KB
最終ジャッジ日時 2024-05-02 04:59:08
合計ジャッジ時間 10,333 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,412 KB
testcase_01 AC 139 ms
41,004 KB
testcase_02 AC 140 ms
40,928 KB
testcase_03 AC 140 ms
41,308 KB
testcase_04 AC 137 ms
41,144 KB
testcase_05 AC 137 ms
41,244 KB
testcase_06 WA -
testcase_07 AC 138 ms
41,180 KB
testcase_08 AC 139 ms
40,932 KB
testcase_09 AC 147 ms
41,572 KB
testcase_10 AC 186 ms
41,644 KB
testcase_11 AC 508 ms
47,868 KB
testcase_12 AC 586 ms
47,704 KB
testcase_13 AC 583 ms
47,640 KB
testcase_14 AC 570 ms
47,712 KB
testcase_15 AC 624 ms
47,916 KB
testcase_16 AC 825 ms
51,552 KB
testcase_17 AC 809 ms
52,440 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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 == 2){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}
0