結果

問題 No.583 鉄道同好会
ユーザー tentententen
提出日時 2022-08-10 17:54:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,325 bytes
コンパイル時間 3,976 ms
コンパイル使用メモリ 77,380 KB
実行使用メモリ 61,180 KB
最終ジャッジ日時 2023-10-21 03:30:34
合計ジャッジ時間 7,822 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
53,484 KB
testcase_01 AC 50 ms
53,480 KB
testcase_02 AC 51 ms
53,476 KB
testcase_03 AC 50 ms
53,484 KB
testcase_04 WA -
testcase_05 AC 51 ms
53,480 KB
testcase_06 AC 50 ms
53,480 KB
testcase_07 AC 50 ms
53,488 KB
testcase_08 AC 49 ms
53,484 KB
testcase_09 AC 50 ms
52,424 KB
testcase_10 AC 59 ms
53,512 KB
testcase_11 AC 149 ms
58,088 KB
testcase_12 AC 158 ms
58,152 KB
testcase_13 AC 160 ms
58,688 KB
testcase_14 AC 162 ms
58,100 KB
testcase_15 AC 177 ms
59,432 KB
testcase_16 AC 229 ms
61,064 KB
testcase_17 AC 245 ms
61,180 KB
testcase_18 AC 228 ms
59,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

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

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0