結果
問題 |
No.390 最長の数列
|
ユーザー |
|
提出日時 | 2019-01-27 15:46:25 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 594 bytes |
コンパイル時間 | 2,405 ms |
コンパイル使用メモリ | 60,952 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 11:02:28 |
合計ジャッジ時間 | 3,079 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
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 var ans = 1.int32 for i in 1..xMax: if dp[i] == 0 : continue let x2 = dp[i] + 1 for j in countup(2*i,xMax,i): if dp[j] == 0 : continue dp[j] .max= x2 ans .max= x2 echo ans