結果

問題 No.365 ジェンガソート
ユーザー ikd
提出日時 2019-08-05 10:05:03
言語 Scheme
(Gauche-0.9.15)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 20,992 KB
最終ジャッジ日時 2024-07-18 13:03:57
合計ジャッジ時間 3,816 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#! /usr/bin/env gosh

(let* ([n (read)]
      [a (let input ([i 0] [li (list)])
           (if (= i n)
             li
             (input (+ i 1) (cons (read) li))))])
  (let ([cost (let solve ([i 0] [li a] [tgt n] [res 0])
    (if (= i n)
      res
      (let ([found (= (car li) tgt)])
        (solve (+ i 1)
               (cdr li)
               (- tgt (if found 1 0))
               (+ res (if found 0 1))))))])
    (display (- n cost))))
0