結果

問題 No.2155 みちらcolor
ユーザー bluemeganebluemegane
提出日時 2022-12-10 16:40:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 1,017 bytes
コンパイル時間 3,148 ms
コンパイル使用メモリ 112,576 KB
実行使用メモリ 28,660 KB
最終ジャッジ日時 2024-04-23 00:07:21
合計ジャッジ時間 7,360 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,988 KB
testcase_01 AC 31 ms
26,928 KB
testcase_02 AC 26 ms
27,796 KB
testcase_03 AC 26 ms
27,916 KB
testcase_04 AC 28 ms
26,244 KB
testcase_05 AC 28 ms
25,672 KB
testcase_06 AC 28 ms
28,136 KB
testcase_07 AC 26 ms
26,032 KB
testcase_08 AC 31 ms
24,504 KB
testcase_09 AC 25 ms
28,308 KB
testcase_10 AC 26 ms
27,784 KB
testcase_11 AC 26 ms
27,936 KB
testcase_12 AC 26 ms
25,740 KB
testcase_13 AC 26 ms
27,928 KB
testcase_14 AC 25 ms
25,624 KB
testcase_15 AC 26 ms
28,192 KB
testcase_16 AC 27 ms
27,884 KB
testcase_17 AC 25 ms
25,832 KB
testcase_18 AC 31 ms
26,308 KB
testcase_19 AC 25 ms
27,684 KB
testcase_20 AC 25 ms
27,928 KB
testcase_21 AC 25 ms
25,844 KB
testcase_22 AC 26 ms
27,880 KB
testcase_23 AC 28 ms
25,988 KB
testcase_24 AC 27 ms
25,852 KB
testcase_25 AC 26 ms
27,752 KB
testcase_26 AC 25 ms
28,244 KB
testcase_27 AC 25 ms
24,368 KB
testcase_28 AC 26 ms
26,092 KB
testcase_29 AC 25 ms
26,420 KB
testcase_30 AC 27 ms
27,884 KB
testcase_31 AC 26 ms
26,032 KB
testcase_32 AC 25 ms
26,224 KB
testcase_33 AC 24 ms
25,840 KB
testcase_34 AC 34 ms
28,660 KB
testcase_35 AC 26 ms
25,672 KB
testcase_36 AC 24 ms
25,840 KB
testcase_37 AC 25 ms
25,904 KB
testcase_38 AC 30 ms
25,728 KB
testcase_39 AC 25 ms
27,772 KB
testcase_40 AC 26 ms
26,032 KB
testcase_41 AC 29 ms
24,500 KB
testcase_42 AC 26 ms
28,056 KB
testcase_43 AC 25 ms
27,924 KB
testcase_44 AC 25 ms
28,140 KB
testcase_45 AC 25 ms
27,924 KB
testcase_46 AC 24 ms
25,744 KB
testcase_47 AC 24 ms
23,864 KB
testcase_48 AC 26 ms
27,876 KB
testcase_49 AC 26 ms
25,964 KB
testcase_50 AC 24 ms
25,844 KB
testcase_51 AC 26 ms
25,948 KB
testcase_52 AC 26 ms
25,580 KB
testcase_53 AC 25 ms
23,860 KB
testcase_54 AC 24 ms
26,100 KB
testcase_55 AC 25 ms
27,800 KB
testcase_56 AC 26 ms
25,620 KB
testcase_57 AC 25 ms
25,960 KB
testcase_58 AC 25 ms
27,800 KB
testcase_59 AC 24 ms
25,752 KB
testcase_60 AC 25 ms
28,060 KB
testcase_61 AC 25 ms
26,004 KB
testcase_62 AC 26 ms
27,872 KB
testcase_63 AC 25 ms
27,796 KB
testcase_64 AC 25 ms
27,672 KB
testcase_65 AC 25 ms
25,968 KB
testcase_66 AC 27 ms
26,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var L = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, m, L, a);
    }
    static void getAns(int n, int m, int L, int[] a)
    {
        var hs = new HashSet<int>[n];
        for (int i = 0; i < n; i++) hs[i] = new HashSet<int>();
        hs[0].Add(L);
        hs[0].Add((L + a[0]) / 2);
        for (int i = 1; i < n; i++)
        {
            foreach (var x in hs[i - 1])
            {
                hs[i].Add(x);
                hs[i].Add((x + a[i]) / 2);
                if (hs[i].Contains(m)) { Console.WriteLine("Yes");return; }
            }
        }
        Console.WriteLine(hs[n - 1].Contains(m) ? "Yes" : "No");
    }
}
0