結果

問題 No.390 最長の数列
ユーザー むらためむらため
提出日時 2019-01-27 15:34:06
言語 Nim
(2.0.2)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 601 bytes
コンパイル時間 2,498 ms
コンパイル使用メモリ 67,268 KB
実行使用メモリ 12,792 KB
最終ジャッジ日時 2023-09-14 03:05:08
合計ジャッジ時間 4,149 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 31 ms
12,792 KB
testcase_06 AC 63 ms
12,788 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 6 ms
10,792 KB
testcase_09 AC 8 ms
10,832 KB
testcase_10 AC 35 ms
12,736 KB
testcase_11 AC 34 ms
12,764 KB
testcase_12 AC 34 ms
12,780 KB
testcase_13 AC 19 ms
12,360 KB
testcase_14 AC 29 ms
5,784 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 6 ms
10,784 KB
testcase_17 AC 7 ms
10,936 KB
testcase_18 AC 6 ms
10,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,algorithm
template `max=`*(x,y) = x = max(x,y)
template `min=`*(x,y) = x = min(x,y)

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord

let n = scan()
let X = newSeqWith(n,scan()).sorted(cmp)
let xMax = X.max()
var dp = newSeqWith(xMax+1,0)
for x in X: dp[x] = 1
# for i in 1..xMax:
  # if dp[i] == 0 : continue
for x in X:
  for j in countup(2*x,xMax,x):
    if dp[j] == 0 : continue
    dp[j] .max= dp[x] + 1
echo dp.max()
0