結果

問題 No.1563 Same Degree
ユーザー 👑 kakel-sankakel-san
提出日時 2024-03-14 23:02:41
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 1,221 bytes
コンパイル時間 15,135 ms
コンパイル使用メモリ 158,796 KB
実行使用メモリ 208,712 KB
最終ジャッジ日時 2024-03-14 23:03:01
合計ジャッジ時間 20,243 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
32,676 KB
testcase_01 AC 134 ms
53,028 KB
testcase_02 AC 129 ms
52,516 KB
testcase_03 AC 130 ms
52,388 KB
testcase_04 AC 134 ms
53,412 KB
testcase_05 AC 131 ms
52,900 KB
testcase_06 AC 122 ms
49,444 KB
testcase_07 AC 122 ms
49,188 KB
testcase_08 AC 150 ms
49,316 KB
testcase_09 AC 123 ms
49,316 KB
testcase_10 AC 122 ms
49,060 KB
testcase_11 AC 98 ms
38,436 KB
testcase_12 AC 112 ms
44,452 KB
testcase_13 AC 198 ms
61,692 KB
testcase_14 AC 204 ms
61,820 KB
testcase_15 AC 176 ms
208,712 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (108 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray();
    static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = NN;
        var ans = new bool[t];
        for (var u = 0; u < t; ++u)
        {
            var c = NList;
            var (n, m) = (c[0], c[1]);
            var map = NMap(m);
            var count = new int[n];
            foreach (var edge in map)
            {
                ++count[edge[0]];
                ++count[edge[1]];
            }
            var clist = new int[n];
            for (var i = 0; i < n; ++i) ++clist[count[i]];
            for (var i = 0; i < n; ++i) if (clist[i] > 1)
            {
                ans[u] = true;
                break;
            }
        }
        WriteLine(string.Join("\n", ans.Select(f => f ? "Yes" : "No")));
    }
}
0