結果

問題 No.406 鴨等間隔の法則
ユーザー 14番14番
提出日時 2016-09-01 09:16:07
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,903 bytes
コンパイル時間 1,148 ms
コンパイル使用メモリ 108,800 KB
実行使用メモリ 33,920 KB
最終ジャッジ日時 2024-04-24 20:38:22
合計ジャッジ時間 4,097 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
23,552 KB
testcase_01 AC 30 ms
19,200 KB
testcase_02 AC 30 ms
19,328 KB
testcase_03 AC 29 ms
19,328 KB
testcase_04 AC 63 ms
28,160 KB
testcase_05 AC 46 ms
22,784 KB
testcase_06 AC 46 ms
22,648 KB
testcase_07 AC 47 ms
22,912 KB
testcase_08 AC 64 ms
28,416 KB
testcase_09 AC 68 ms
28,672 KB
testcase_10 AC 48 ms
23,424 KB
testcase_11 AC 63 ms
27,904 KB
testcase_12 AC 52 ms
24,960 KB
testcase_13 AC 50 ms
24,228 KB
testcase_14 WA -
testcase_15 AC 34 ms
20,096 KB
testcase_16 AC 38 ms
20,352 KB
testcase_17 AC 35 ms
20,096 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 40 ms
21,128 KB
testcase_22 WA -
testcase_23 AC 51 ms
24,508 KB
testcase_24 WA -
testcase_25 AC 71 ms
29,824 KB
testcase_26 WA -
testcase_27 AC 67 ms
28,416 KB
testcase_28 AC 68 ms
28,544 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 68 ms
28,544 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.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 = @"


5
63 17 99 34 51



";
        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