結果

問題 No.406 鴨等間隔の法則
ユーザー 14番14番
提出日時 2016-09-01 09:22:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 1,900 bytes
コンパイル時間 3,025 ms
コンパイル使用メモリ 105,492 KB
実行使用メモリ 38,792 KB
最終ジャッジ日時 2023-09-21 18:06:17
合計ジャッジ時間 7,818 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
24,432 KB
testcase_01 AC 66 ms
23,880 KB
testcase_02 AC 67 ms
21,764 KB
testcase_03 AC 62 ms
21,712 KB
testcase_04 AC 101 ms
29,352 KB
testcase_05 AC 82 ms
24,144 KB
testcase_06 AC 83 ms
23,856 KB
testcase_07 AC 82 ms
23,848 KB
testcase_08 AC 101 ms
29,296 KB
testcase_09 AC 103 ms
29,416 KB
testcase_10 AC 85 ms
26,484 KB
testcase_11 AC 99 ms
29,424 KB
testcase_12 AC 90 ms
27,636 KB
testcase_13 AC 86 ms
24,960 KB
testcase_14 AC 149 ms
36,528 KB
testcase_15 AC 71 ms
22,244 KB
testcase_16 AC 80 ms
24,824 KB
testcase_17 AC 78 ms
22,488 KB
testcase_18 AC 82 ms
22,896 KB
testcase_19 AC 81 ms
22,940 KB
testcase_20 AC 85 ms
22,852 KB
testcase_21 AC 84 ms
20,996 KB
testcase_22 AC 93 ms
24,472 KB
testcase_23 AC 89 ms
28,964 KB
testcase_24 AC 137 ms
31,868 KB
testcase_25 AC 104 ms
30,576 KB
testcase_26 AC 169 ms
38,792 KB
testcase_27 AC 101 ms
29,384 KB
testcase_28 AC 102 ms
29,220 KB
testcase_29 AC 164 ms
37,936 KB
testcase_30 AC 162 ms
37,696 KB
testcase_31 AC 101 ms
27,228 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.Collections.Generic;
using System.Text;
using System.Linq;


class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int kamoCount = int.Parse(Reader.ReadLine());
        int[] kamoList = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        Dictionary<int, bool> dic = new Dictionary<int, bool>();

        string ans = "YES";
        for (int i = 0; i < kamoList.Length; i++)
        {
            if (dic.ContainsKey(kamoList[i]))
            {
                ans = "NO";
                break;
            }
            dic.Add(kamoList[i], true);
        }

        if (ans.Equals("YES"))
        {
            List<int> keys = dic.Keys.OrderBy(a=>a).ToList();
            int prev = -1;
            for (int i = 1; i < keys.Count; i++)
            {
                if (prev > 0)
                {
                    if (prev != keys[i] - keys[i - 1])
                    {
                        ans = "NO";
                        break;
                    }
                }
                else
                {
                    prev = keys[i] - keys[i - 1];
                }
            }
        }
        Console.WriteLine(ans);

    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"





";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0