結果

問題 No.110 しましまピラミッド
ユーザー むらため
提出日時 2019-01-21 14:05:19
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 2,471 ms
コンパイル使用メモリ 62,112 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 10:29:32
合計ジャッジ時間 3,525 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    var k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord
let nw = scan()
let W = newSeqWith(nw,scan())
let nb = scan()
let B = newSeqWith(nb,scan())
# W が下
proc check(isB:bool) : int =
  var size = if isB: B.max() else: W.max()
  var isB = not isB
  result = 1
  while true:
    let C = if isB : B else: W
    let cf =  C.filterIt(it < size)
    if cf.len == 0 : return
    size = cf.max()
    isB = not isB
    result += 1
echo check(true).max(check(false))
0