結果
問題 | No.209 Longest Mountain Subsequence |
ユーザー | yuppe19 😺 |
提出日時 | 2016-07-06 15:21:26 |
言語 | Nim (2.0.2) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 680 bytes |
コンパイル時間 | 1,211 ms |
コンパイル使用メモリ | 57,232 KB |
最終ジャッジ日時 | 2023-09-12 00:57:59 |
合計ジャッジ時間 | 1,665 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(13, 19) Error: type mismatch: got <int> but expected one of: proc `<`(x, y: int): bool first type mismatch at position: 2 missing parameter: y proc `<`(x, y: int64): bool first type mismatch at position: 2 missing parameter: y 19 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them expression: <n
ソースコード
import strutils, sequtils var n: int a: seq[int] dp: seq[seq[int]] t = stdin.readLine.parseInt proc nya(i, j: int) : int = if dp[i][j] != -1: return dp[i][j] result = 2 var x = a[j] - a[i] for k in j+1 .. <n: var y = a[k] - a[j] if (x > 0 and y > 0 and x < y) or (x < 0 and y < 0 and x < y) or (x > 0 and y < 0): result = max(result, nya(j, k)+1) dp[i][j] = result for cases in 0 .. <t: n = stdin.readLine.parseInt a = stdin.readLine.split.map(parseInt) dp = newSeqWith(n, newSeqWith(n, -1)) var res = 1 for i in 0 .. <n: for j in i+1 .. <n: if a[i] == a[j]: continue res = max(res, nya(i, j)) echo res