結果

問題 No.1563 Same Degree
ユーザー AsahiAsahi
提出日時 2023-02-04 18:41:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 825 ms / 2,000 ms
コード長 1,345 bytes
コンパイル時間 2,157 ms
コンパイル使用メモリ 74,932 KB
実行使用メモリ 65,132 KB
最終ジャッジ日時 2023-09-16 15:10:12
合計ジャッジ時間 12,595 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,608 KB
testcase_01 AC 629 ms
62,056 KB
testcase_02 AC 586 ms
62,812 KB
testcase_03 AC 591 ms
63,748 KB
testcase_04 AC 629 ms
62,276 KB
testcase_05 AC 594 ms
62,148 KB
testcase_06 AC 535 ms
63,152 KB
testcase_07 AC 567 ms
61,472 KB
testcase_08 AC 558 ms
60,892 KB
testcase_09 AC 569 ms
61,252 KB
testcase_10 AC 559 ms
61,484 KB
testcase_11 AC 387 ms
60,744 KB
testcase_12 AC 522 ms
60,380 KB
testcase_13 AC 785 ms
64,608 KB
testcase_14 AC 825 ms
64,568 KB
testcase_15 AC 730 ms
65,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;

public class Main{
    /* 入出力 */
    static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter output = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    /* 定数 */
    static final int [] y4 = {0,1,0,-1};
    static final int [] x4 = {1,0,-1,0};
    static final int  INF1 = Integer.MAX_VALUE;
    static final long INF2 = Long.MAX_VALUE;
    static final long MOD1 = (long)1e9+7;
    static final long MOD2 = 998244353;
    /* Main */
    public static void main(String[] args) throws IOException{
        int T = sc.nextInt();
        while(T-->0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            boolean ok = false;
            int [] degree = new int[n+1];
            int [] cnt = new int[n+1];
            while(m-->0) {
                int u = sc.nextInt();
                int v = sc.nextInt();
                degree[u]++;
                degree[v]++;
            }
            for(int i=1;i<=n;i++) {
                cnt[degree[i]]++;
                if(cnt[degree[i]] > 1) ok = true;
            }
            output.println(ok?"Yes":"No");
        }
        output.flush();        
    }
}
0