結果

問題 No.365 ジェンガソート
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-21 03:14:13
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 3,127 ms
コンパイル使用メモリ 70,540 KB
実行使用メモリ 13,572 KB
最終ジャッジ日時 2023-09-13 07:31:25
合計ジャッジ時間 7,728 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 272 ms
5,172 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, algorithm

let N, a = stdin.readLine.split.map(parseInt).reversed

proc jenga(a: seq[int]): int =
  if a[0] == a.max:
    result = jenga a[1 .. ^1]
  else:
    for a_i in a:
      if a_i == a.max:
        return result
      result = max(result, a_i)


if a == a.sorted(cmp, Descending):
  echo 0
else:
  echo a.jenga
0