結果

問題 No.349 干支の置き物
ユーザー NoNo
提出日時 2017-05-24 22:08:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 834 bytes
コンパイル時間 909 ms
コンパイル使用メモリ 109,188 KB
実行使用メモリ 25,012 KB
最終ジャッジ日時 2023-10-19 22:38:50
合計ジャッジ時間 3,020 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,948 KB
testcase_01 AC 27 ms
24,944 KB
testcase_02 AC 26 ms
24,948 KB
testcase_03 AC 27 ms
25,012 KB
testcase_04 AC 28 ms
25,012 KB
testcase_05 AC 26 ms
25,012 KB
testcase_06 AC 27 ms
25,012 KB
testcase_07 AC 26 ms
25,012 KB
testcase_08 AC 28 ms
25,012 KB
testcase_09 AC 27 ms
25,012 KB
testcase_10 AC 27 ms
25,012 KB
testcase_11 AC 27 ms
25,012 KB
testcase_12 AC 27 ms
25,012 KB
testcase_13 AC 27 ms
25,012 KB
testcase_14 AC 27 ms
25,012 KB
testcase_15 AC 27 ms
25,012 KB
testcase_16 AC 27 ms
25,012 KB
testcase_17 AC 27 ms
25,012 KB
testcase_18 AC 27 ms
24,944 KB
testcase_19 AC 26 ms
25,012 KB
testcase_20 AC 26 ms
24,944 KB
testcase_21 AC 28 ms
24,948 KB
testcase_22 AC 27 ms
25,012 KB
testcase_23 AC 27 ms
25,012 KB
testcase_24 AC 26 ms
24,948 KB
testcase_25 AC 27 ms
24,948 KB
testcase_26 AC 27 ms
25,012 KB
testcase_27 AC 27 ms
25,012 KB
testcase_28 AC 26 ms
24,948 KB
testcase_29 AC 28 ms
25,012 KB
testcase_30 AC 26 ms
24,948 KB
testcase_31 AC 27 ms
24,948 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;

namespace Yuki
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var d = new Dictionary<string, int>();
            for (int i = 0; i < n; i++)
            {
                string s = Console.ReadLine();
                if (d.ContainsKey(s)) d[s] += 1;
                else d.Add(s, 1);
            }

            var k = d.Values.Max();
            if (n % 2 == 1 && k <= (n + 1) / 2)
            {
                Console.WriteLine("YES");
            }
            else if (n % 2 == 0 && k <= n / 2)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}
0