結果

問題 No.2798 Multiple Chain
ユーザー 👑 kakel-sankakel-san
提出日時 2024-06-28 23:19:35
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,863 bytes
コンパイル時間 7,671 ms
コンパイル使用メモリ 167,880 KB
実行使用メモリ 186,740 KB
最終ジャッジ日時 2024-06-28 23:19:56
合計ジャッジ時間 13,587 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
31,480 KB
testcase_01 AC 76 ms
31,360 KB
testcase_02 AC 80 ms
31,488 KB
testcase_03 AC 78 ms
31,616 KB
testcase_04 AC 82 ms
31,488 KB
testcase_05 AC 81 ms
31,488 KB
testcase_06 AC 79 ms
31,600 KB
testcase_07 AC 79 ms
31,488 KB
testcase_08 AC 77 ms
31,616 KB
testcase_09 AC 81 ms
31,704 KB
testcase_10 AC 79 ms
31,488 KB
testcase_11 AC 77 ms
31,488 KB
testcase_12 AC 79 ms
31,488 KB
testcase_13 AC 79 ms
31,488 KB
testcase_14 AC 78 ms
31,488 KB
testcase_15 AC 79 ms
31,616 KB
testcase_16 AC 79 ms
31,616 KB
testcase_17 AC 80 ms
31,488 KB
testcase_18 AC 79 ms
31,488 KB
testcase_19 AC 78 ms
31,616 KB
testcase_20 AC 78 ms
31,360 KB
testcase_21 AC 77 ms
31,360 KB
testcase_22 AC 77 ms
31,360 KB
testcase_23 AC 79 ms
31,360 KB
testcase_24 AC 76 ms
31,232 KB
testcase_25 AC 76 ms
31,488 KB
testcase_26 AC 76 ms
31,616 KB
testcase_27 AC 78 ms
31,480 KB
testcase_28 AC 75 ms
31,488 KB
testcase_29 AC 74 ms
31,600 KB
testcase_30 AC 76 ms
31,488 KB
testcase_31 AC 77 ms
31,480 KB
testcase_32 WA -
testcase_33 AC 79 ms
31,472 KB
testcase_34 WA -
testcase_35 AC 77 ms
31,704 KB
testcase_36 AC 82 ms
31,616 KB
testcase_37 AC 78 ms
31,596 KB
testcase_38 AC 77 ms
31,608 KB
testcase_39 AC 77 ms
31,488 KB
testcase_40 AC 76 ms
31,488 KB
testcase_41 AC 74 ms
31,488 KB
testcase_42 AC 75 ms
31,488 KB
testcase_43 AC 80 ms
31,744 KB
testcase_44 AC 78 ms
31,488 KB
testcase_45 AC 77 ms
31,616 KB
testcase_46 AC 77 ms
31,488 KB
testcase_47 AC 79 ms
31,488 KB
testcase_48 AC 79 ms
31,480 KB
testcase_49 AC 80 ms
31,488 KB
testcase_50 AC 79 ms
31,480 KB
testcase_51 AC 79 ms
31,616 KB
testcase_52 AC 77 ms
31,488 KB
testcase_53 AC 80 ms
186,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = long.Parse(ReadLine());
        var dic = new Dictionary<long, int>();
        var tmp = n;
        for (var i = 2; i <= 1000000; ++i)
        {
            while (tmp % i == 0)
            {
                if (dic.ContainsKey(i)) ++dic[i];
                else dic[i] = 1;
                tmp /= i;
            }
        }
        if (tmp > 1)
        {
            var ok = 1_000_000_000L;
            var ng = 0L;
            while (ok - ng > 1)
            {
                var mid = (ok + ng) / 2;
                if (mid * mid >= n) ok = mid;
                else ng = mid;
            }
            dic[ok] = 1;
        }
        var ans = 1L;
        foreach (var kv in dic)
        {
            var dp = new long[kv.Value + 1][];
            for (var i = 0; i < dp.Length; ++i) dp[i] = new long[kv.Value + 1];
            for (var i = 1; i <= kv.Value; ++i) dp[i][i] = 1;
            for (var i = 1; i < kv.Value; ++i)
            {
                for (var j = i; j < kv.Value; ++j)
                {
                    for (var k = i; j + k <= kv.Value; ++k)
                    {
                        dp[k][j + k] += dp[i][j];
                    }
                }
            }
            // WriteLine(string.Join("\n", dp.Select(di => string.Join(" ", di))));
            ans *= dp.Sum(di => di[kv.Value]);
        }
        WriteLine(ans);
    }
}
0