結果
問題 | No.156 キャンディー・ボックス |
ユーザー |
|
提出日時 | 2016-06-23 16:45:54 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 700 bytes |
コンパイル時間 | 129 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 27,816 KB |
最終ジャッジ日時 | 2024-10-11 18:36:43 |
合計ジャッジ時間 | 6,325 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 2 TLE * 1 -- * 27 |
ソースコード
(define (iota n . args) (let ((start (if (pair? args) (car args) 0)) (step (if (and (pair? args) (pair? (cdr args))) (cadr args) 1))) (let loop ((m n) (last (+ start (* step (- n 1)))) (a '())) (if (zero? m) a (loop (- m 1) (- last step) (cons last a)))))) (define (take-candy a) (let ((a (sort a <))) (cons (- (car a) 1) (cdr a)))) (define (take-candy-rec M C) (let loop((M M) (C C)) (let ((C (filter positive? C))) (if (zero? M) C (loop (- M 1) (take-candy C)))))) (define (solve N M C) (- N (length (take-candy-rec M C)))) (display (let* ((N (read)) (M (read)) (C (map (lambda (x) (read)) (iota N)))) (solve N M C))) (newline)