結果

問題 No.583 鉄道同好会
ユーザー tentententen
提出日時 2022-10-14 17:17:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,344 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 57,804 KB
最終ジャッジ日時 2023-09-08 19:45:42
合計ジャッジ時間 5,182 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,280 KB
testcase_01 AC 42 ms
49,220 KB
testcase_02 AC 43 ms
49,332 KB
testcase_03 AC 43 ms
49,328 KB
testcase_04 WA -
testcase_05 AC 43 ms
49,584 KB
testcase_06 AC 43 ms
49,364 KB
testcase_07 AC 42 ms
49,276 KB
testcase_08 AC 45 ms
49,252 KB
testcase_09 AC 44 ms
49,392 KB
testcase_10 AC 50 ms
49,264 KB
testcase_11 AC 138 ms
54,492 KB
testcase_12 AC 160 ms
55,780 KB
testcase_13 AC 159 ms
55,540 KB
testcase_14 AC 156 ms
56,028 KB
testcase_15 AC 170 ms
55,856 KB
testcase_16 AC 214 ms
57,804 KB
testcase_17 AC 236 ms
57,608 KB
testcase_18 AC 236 ms
57,772 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 judge = 0;
        for (int x : counts) {
            judge += x % 2;
        }
        if (judge <= 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    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