結果
| 問題 |
No.390 最長の数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-27 15:36:33 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 71 ms / 5,000 ms |
| コード長 | 600 bytes |
| コンパイル時間 | 2,544 ms |
| コンパイル使用メモリ | 61,976 KB |
| 実行使用メモリ | 11,512 KB |
| 最終ジャッジ日時 | 2024-07-01 11:02:18 |
| 合計ジャッジ時間 | 3,570 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
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())
let xMax = X.max()
var dp = newSeqWith(xMax+1,0)
for x in X: dp[x] = 1
var ans = 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
ans .max= dp[j]
echo ans