結果

問題 No.365 ジェンガソート
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-21 02:06:28
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 3,137 ms
コンパイル使用メモリ 70,168 KB
実行使用メモリ 14,968 KB
最終ジャッジ日時 2023-09-13 07:30:41
合計ジャッジ時間 5,858 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 11 ms
5,180 KB
testcase_22 AC 38 ms
11,364 KB
testcase_23 AC 22 ms
7,632 KB
testcase_24 AC 36 ms
11,132 KB
testcase_25 AC 11 ms
5,064 KB
testcase_26 WA -
testcase_27 AC 50 ms
13,704 KB
testcase_28 AC 28 ms
9,524 KB
testcase_29 AC 43 ms
12,076 KB
testcase_30 AC 30 ms
9,896 KB
testcase_31 AC 13 ms
5,500 KB
testcase_32 AC 12 ms
5,492 KB
testcase_33 AC 50 ms
13,784 KB
testcase_34 AC 8 ms
4,912 KB
testcase_35 WA -
testcase_36 AC 25 ms
13,148 KB
testcase_37 AC 41 ms
14,968 KB
testcase_38 WA -
testcase_39 AC 31 ms
14,964 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, algorithm

var
  N = stdin.readLine.parseInt
  a = stdin.readLine.split.map parseInt
  cnt_S = int.high
  cnt_L = int.low

if a != a.sorted(cmp):
  for a_i in a:
    if a_i == 1: break
    cnt_S = min(cnt_S, a_i)

  for a_i in a.reversed:
    if a_i == N: break
    cnt_L = max(cnt_L, a_i)

  echo max(cnt_L, N - cnt_S)
else:
  echo 0
0