結果

問題 No.2537 多重含意
ユーザー 👑 kakel-sankakel-san
提出日時 2023-11-10 23:33:53
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,232 bytes
コンパイル時間 6,677 ms
コンパイル使用メモリ 158,520 KB
実行使用メモリ 195,352 KB
最終ジャッジ日時 2023-11-10 23:34:06
合計ジャッジ時間 9,977 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
32,804 KB
testcase_01 AC 76 ms
32,804 KB
testcase_02 AC 75 ms
32,804 KB
testcase_03 AC 75 ms
32,804 KB
testcase_04 AC 76 ms
32,804 KB
testcase_05 AC 82 ms
32,804 KB
testcase_06 AC 75 ms
32,804 KB
testcase_07 AC 76 ms
32,804 KB
testcase_08 AC 75 ms
32,804 KB
testcase_09 AC 76 ms
32,804 KB
testcase_10 AC 75 ms
32,804 KB
testcase_11 AC 76 ms
32,804 KB
testcase_12 AC 76 ms
32,804 KB
testcase_13 AC 75 ms
32,804 KB
testcase_14 AC 75 ms
32,804 KB
testcase_15 AC 76 ms
33,060 KB
testcase_16 AC 78 ms
33,188 KB
testcase_17 AC 83 ms
35,236 KB
testcase_18 AC 142 ms
47,780 KB
testcase_19 AC 114 ms
47,652 KB
testcase_20 AC 114 ms
47,908 KB
testcase_21 AC 115 ms
47,908 KB
testcase_22 AC 114 ms
47,908 KB
testcase_23 AC 115 ms
195,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (93 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.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 string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, b) = (c[0], c[1]);
        var a = NList;
        WriteLine(X(n, b, a));
    }
    static string X(int n, int b, int[] a)
    {
        var counts = new int[n + 1];
        var kinds = 0;
        var mul = new long[n + 1];
        mul[0] = 1 % b;
        for (var i = 1; i < mul.Length; ++i) mul[i] = mul[i - 1] * 2 % b;
        var ans = new long[n];
        for (var i = 0; i < n; ++i)
        {
            if (counts[a[i]] == 0) ++kinds;
            ++counts[a[i]];
            if (counts[a[i]] > 1)
            {
                ans[i] = mul[n];
            }
            else
            {
                ans[i] = (mul[n] - mul[n - kinds] + b) % b;
            }
        }
        return string.Join("\n", ans);
    }
}
0