結果

問題 No.2218 Multiple LIS
ユーザー maguroflymagurofly
提出日時 2023-02-17 21:52:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,606 ms / 3,000 ms
コード長 373 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 11,256 KB
実行使用メモリ 29,144 KB
最終ジャッジ日時 2023-09-26 19:10:37
合計ジャッジ時間 24,948 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,248 KB
testcase_01 AC 79 ms
15,128 KB
testcase_02 AC 79 ms
15,136 KB
testcase_03 AC 83 ms
15,260 KB
testcase_04 AC 78 ms
15,036 KB
testcase_05 AC 81 ms
15,128 KB
testcase_06 AC 80 ms
15,180 KB
testcase_07 AC 80 ms
15,336 KB
testcase_08 AC 78 ms
15,324 KB
testcase_09 AC 79 ms
15,156 KB
testcase_10 AC 79 ms
15,260 KB
testcase_11 AC 79 ms
15,168 KB
testcase_12 AC 80 ms
15,320 KB
testcase_13 AC 82 ms
15,100 KB
testcase_14 AC 82 ms
15,212 KB
testcase_15 AC 82 ms
15,276 KB
testcase_16 AC 79 ms
15,292 KB
testcase_17 AC 83 ms
15,132 KB
testcase_18 AC 78 ms
15,236 KB
testcase_19 AC 80 ms
15,140 KB
testcase_20 AC 82 ms
15,180 KB
testcase_21 AC 161 ms
17,528 KB
testcase_22 AC 626 ms
22,980 KB
testcase_23 AC 1,022 ms
26,040 KB
testcase_24 AC 268 ms
19,920 KB
testcase_25 AC 1,150 ms
25,320 KB
testcase_26 AC 1,606 ms
29,028 KB
testcase_27 AC 1,604 ms
28,940 KB
testcase_28 AC 1,605 ms
29,144 KB
testcase_29 AC 1,604 ms
29,124 KB
testcase_30 AC 1,604 ms
28,924 KB
testcase_31 AC 653 ms
24,696 KB
testcase_32 AC 656 ms
24,976 KB
testcase_33 AC 656 ms
24,776 KB
testcase_34 AC 653 ms
24,784 KB
testcase_35 AC 667 ms
24,772 KB
testcase_36 AC 166 ms
23,536 KB
testcase_37 AC 2,606 ms
26,996 KB
testcase_38 AC 79 ms
15,328 KB
testcase_39 AC 79 ms
15,132 KB
testcase_40 AC 1,851 ms
23,900 KB
testcase_41 AC 1,851 ms
24,036 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)

def divisors(n)
    divisors = []
    k = 1
    while k * k < n
        divisors << k << (n / k) if n % k == 0
        k += 1
    end
    divisors << k if k * k == n
    divisors.sort
end

lis = Hash.new(0)
A.each do |x|
    divisors(x).reverse_each do |y|
        lis[x] = [lis[x], lis[y] + 1].max
    end
end

puts lis.values.max
0