結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー tomomo2b2tomomo2b2
提出日時 2020-01-31 21:30:17
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,277 bytes
コンパイル時間 1,420 ms
コンパイル使用メモリ 108,612 KB
実行使用メモリ 51,704 KB
最終ジャッジ日時 2023-10-17 08:46:03
合計ジャッジ時間 4,267 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
26,376 KB
testcase_01 AC 32 ms
26,376 KB
testcase_02 AC 32 ms
26,376 KB
testcase_03 AC 32 ms
26,376 KB
testcase_04 AC 32 ms
26,376 KB
testcase_05 AC 32 ms
26,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 32 ms
26,376 KB
testcase_09 AC 32 ms
26,376 KB
testcase_10 AC 32 ms
26,376 KB
testcase_11 AC 32 ms
26,376 KB
testcase_12 AC 32 ms
26,376 KB
testcase_13 WA -
testcase_14 AC 49 ms
31,356 KB
testcase_15 AC 50 ms
31,356 KB
testcase_16 WA -
testcase_17 AC 50 ms
31,536 KB
testcase_18 WA -
testcase_19 AC 92 ms
36,032 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 301 ms
50,716 KB
testcase_24 AC 265 ms
51,704 KB
testcase_25 AC 301 ms
50,716 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

class MyClass
{
    public static void Solve()
    {
        var N = int.Parse(Console.ReadLine());
        var adj = new HashSet<int>[N];
        for (int i = 0; i < N; i++)
        {
            adj[i] = new HashSet<int>();
        }
        for (int i = 0; i < N-1; i++)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var u = input[0];
            var v = input[1];
            adj[u].Add(v);
            adj[v].Add(u);
        }
        var sol = 0;
        var deg1 = 0;
        for (int i = 0; i < N; i++)
        {
            if (adj[i].Count == 0)
            {
                sol++;
            }
            else if (adj[i].Count == 1)
            {
                deg1++;
            }
        }
        if (sol >= 2 || (sol == 1 && deg1 >= 1))
        {
            Console.WriteLine("Alice");
        }
        else
        {
            Console.WriteLine("Bob");
        }
    }

    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
0