結果

問題 No.45 回転寿司
ユーザー toshiro_yanagi
提出日時 2018-06-16 18:22:09
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 3,228 ms
コンパイル使用メモリ 65,720 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 16:20:28
合計ジャッジ時間 4,550 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, algorithm

proc getStr: auto =
  stdin.readLine

proc go(V: seq[int]): int =
  var i = 0
  while i < V.len:
    if i != V.high:
      if V[i] < V[i + 1]:
        inc i
        continue
    inc result, V[i]
    inc i, 2

let
  N = getStr().parseInt
  V = getStr().split.map parseInt

echo max(V.go, V.reversed.go)
0