結果

問題 No.2218 Multiple LIS
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-26 19:49:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 329 ms / 3,000 ms
コード長 955 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 70,392 KB
実行使用メモリ 36,780 KB
最終ジャッジ日時 2023-08-26 19:50:02
合計ジャッジ時間 9,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,620 KB
testcase_01 AC 62 ms
23,596 KB
testcase_02 AC 62 ms
21,692 KB
testcase_03 AC 62 ms
21,704 KB
testcase_04 AC 62 ms
19,656 KB
testcase_05 AC 65 ms
21,588 KB
testcase_06 AC 63 ms
23,784 KB
testcase_07 AC 61 ms
21,552 KB
testcase_08 AC 62 ms
21,596 KB
testcase_09 AC 62 ms
21,712 KB
testcase_10 AC 62 ms
21,624 KB
testcase_11 AC 62 ms
21,644 KB
testcase_12 AC 70 ms
21,920 KB
testcase_13 AC 70 ms
23,744 KB
testcase_14 AC 74 ms
23,760 KB
testcase_15 AC 70 ms
21,680 KB
testcase_16 AC 68 ms
21,712 KB
testcase_17 AC 71 ms
19,764 KB
testcase_18 AC 63 ms
19,500 KB
testcase_19 AC 71 ms
23,736 KB
testcase_20 AC 71 ms
21,732 KB
testcase_21 AC 79 ms
22,536 KB
testcase_22 AC 135 ms
30,836 KB
testcase_23 AC 170 ms
30,544 KB
testcase_24 AC 91 ms
26,784 KB
testcase_25 AC 183 ms
31,548 KB
testcase_26 AC 235 ms
33,488 KB
testcase_27 AC 231 ms
35,688 KB
testcase_28 AC 229 ms
33,572 KB
testcase_29 AC 229 ms
33,528 KB
testcase_30 AC 230 ms
35,544 KB
testcase_31 AC 159 ms
34,696 KB
testcase_32 AC 156 ms
36,780 KB
testcase_33 AC 155 ms
34,772 KB
testcase_34 AC 154 ms
32,596 KB
testcase_35 AC 165 ms
34,684 KB
testcase_36 AC 105 ms
33,192 KB
testcase_37 AC 329 ms
34,812 KB
testcase_38 AC 66 ms
23,648 KB
testcase_39 AC 62 ms
23,692 KB
testcase_40 AC 264 ms
33,632 KB
testcase_41 AC 266 ms
35,640 KB
権限があれば一括ダウンロードができます

ソースコード

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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var dp = new int[100001];
        foreach (var ai in a)
        {
            var max = 0;
            foreach (var d in Divs(ai)) max = Math.Max(max, dp[d]);
            dp[ai] = Math.Max(dp[ai], max + 1);
        }
        WriteLine(dp.Max());
    }
    static List<int> Divs(int n)
    {
        var ans = new List<int>();
        for (var i = 1; i * i <= n; ++i)
        {
            if (n % i == 0)
            {
                ans.Add(i);
                if (i * i < n) ans.Add(n / i);
            }
        }
        return ans;
    }
}
0