結果
問題 |
No.45 回転寿司
|
ユーザー |
|
提出日時 | 2022-12-23 06:12:45 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 362 bytes |
コンパイル時間 | 5,178 ms |
コンパイル使用メモリ | 66,784 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 03:56:35 |
合計ジャッジ時間 | 4,681 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(4, 8) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(3, 8) Warning: imported and not used: 'bitops' [UnusedImport]
ソースコード
import sequtils import strutils import bitops import math import deques var n = stdin.readLine.parseInt var a = stdin.readLine.split.map parseInt var DP = newSeq[int](n+1) proc get[T](s:seq[T],index :int):T= if index < 0 or s.len <= index: return 0 return s[index] for i in 0..n: DP[i] = max(DP.get(i-2)+a.get(i),DP.get(i-1)) echo DP[n]