結果

問題 No.2803 Bocching Star
ユーザー kakel-sankakel-san
提出日時 2024-07-13 19:09:19
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 1,225 bytes
コンパイル時間 10,934 ms
コンパイル使用メモリ 168,024 KB
実行使用メモリ 189,400 KB
最終ジャッジ日時 2024-07-13 19:09:37
合計ジャッジ時間 18,357 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
30,976 KB
testcase_01 AC 60 ms
30,976 KB
testcase_02 AC 61 ms
31,104 KB
testcase_03 AC 79 ms
35,328 KB
testcase_04 AC 155 ms
57,028 KB
testcase_05 AC 110 ms
45,564 KB
testcase_06 AC 72 ms
34,432 KB
testcase_07 AC 105 ms
42,452 KB
testcase_08 AC 85 ms
38,272 KB
testcase_09 AC 153 ms
59,152 KB
testcase_10 AC 161 ms
58,200 KB
testcase_11 AC 170 ms
58,452 KB
testcase_12 AC 97 ms
41,856 KB
testcase_13 AC 143 ms
56,088 KB
testcase_14 AC 119 ms
51,360 KB
testcase_15 AC 172 ms
57,796 KB
testcase_16 AC 122 ms
46,976 KB
testcase_17 AC 83 ms
37,120 KB
testcase_18 AC 76 ms
35,456 KB
testcase_19 AC 147 ms
56,388 KB
testcase_20 AC 114 ms
46,080 KB
testcase_21 AC 103 ms
44,160 KB
testcase_22 AC 105 ms
44,024 KB
testcase_23 AC 194 ms
58,676 KB
testcase_24 AC 192 ms
60,972 KB
testcase_25 AC 186 ms
60,084 KB
testcase_26 AC 188 ms
60,340 KB
testcase_27 AC 172 ms
58,540 KB
testcase_28 AC 180 ms
58,676 KB
testcase_29 AC 172 ms
58,544 KB
testcase_30 AC 187 ms
60,432 KB
testcase_31 AC 167 ms
58,416 KB
testcase_32 AC 195 ms
60,852 KB
testcase_33 AC 64 ms
31,616 KB
testcase_34 AC 65 ms
31,616 KB
testcase_35 AC 64 ms
31,488 KB
testcase_36 AC 64 ms
31,616 KB
testcase_37 AC 64 ms
189,400 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (99 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

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

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    static int[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(ReadLine())).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, p) = (c[0], c[1]);
        var a = NList;
        var list = new List<(int id, int ai)>();
        for (var i = 0; i < n; ++i) list.Add((i, a[i]));
        list.Sort((l, r) => l.ai.CompareTo(r.ai));
        var ans = new List<int>();
        for (var i = 0; i < n; ++i)
        {
            var flg = true;
            if (i > 0 && list[i].ai - list[i - 1].ai <= p) flg = false;
            if (i + 1 < n && list[i + 1].ai - list[i].ai <= p) flg = false;
            if (flg) ans.Add(list[i].id);
        }
        ans.Sort();
        WriteLine(ans.Count);
        WriteLine(string.Join(" ", ans.Select(ai => ai + 1)));
    }
}
0