結果

問題 No.583 鉄道同好会
ユーザー sca1lsca1l
提出日時 2017-10-27 23:13:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 73,948 KB
実行使用メモリ 64,260 KB
最終ジャッジ日時 2024-05-01 17:39:05
合計ジャッジ時間 8,877 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
41,240 KB
testcase_01 AC 110 ms
41,312 KB
testcase_02 AC 115 ms
39,880 KB
testcase_03 AC 115 ms
40,912 KB
testcase_04 WA -
testcase_05 AC 103 ms
41,272 KB
testcase_06 AC 116 ms
40,992 KB
testcase_07 AC 119 ms
41,024 KB
testcase_08 AC 123 ms
41,016 KB
testcase_09 AC 120 ms
41,812 KB
testcase_10 AC 152 ms
41,808 KB
testcase_11 AC 405 ms
48,040 KB
testcase_12 AC 478 ms
47,860 KB
testcase_13 AC 499 ms
47,996 KB
testcase_14 AC 495 ms
48,056 KB
testcase_15 AC 530 ms
48,176 KB
testcase_16 AC 657 ms
51,816 KB
testcase_17 AC 726 ms
63,480 KB
testcase_18 AC 687 ms
64,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        int[] c = new int[n];
        
        for(int i=0; i<m*2; i++){
            c[sc.nextInt()]++;
        }
        
        int odd = 0;
        for(int i=0; i<n; i++){
            if(c[i]%2==1){
               odd++;
            }
        }
        
        if(odd==0 || odd==2){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}
0