結果

問題 No.390 最長の数列
ユーザー むらためむらため
提出日時 2019-01-27 15:44:29
言語 Nim
(2.0.2)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 550 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 66,856 KB
実行使用メモリ 6,928 KB
最終ジャッジ日時 2023-09-14 03:05:31
合計ジャッジ時間 2,716 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 40 ms
6,816 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 11 ms
6,928 KB
testcase_11 AC 11 ms
6,888 KB
testcase_12 AC 11 ms
6,900 KB
testcase_13 AC 12 ms
6,884 KB
testcase_14 AC 6 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 4 ms
6,876 KB
testcase_18 AC 5 ms
6,916 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

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

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int32 =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10.int32 * result + k.ord.int32 - '0'.ord.int32
var dp : array[1_00_0010,int32]
let n = scan()
var xMax = 0
for i in 0..<n:
  let a = scan()
  xMax .max= a
  dp[a] = 1
for i in 1..xMax:
  if dp[i] == 0 : continue
  for j in countup(2*i,xMax,i):
    if dp[j] == 0 : continue
    dp[j] .max= dp[i] + 1
echo dp.max()
0