結果

問題 No.548 国士無双
ユーザー ducktail
提出日時 2017-12-25 23:51:19
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-09-17 13:49:04
合計ジャッジ時間 1,625 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

(use srfi-13)

(define (main args)
  (let ([s (read-line)]
        [tm (alist->tree-map (map cons (string->list "abcdefghijklm") (make-list 13 0)))])
    (string-for-each (lambda (c)
                       (cond [(char<=? #\a c #\m) (tree-map-update! tm c (cut + <> 1))]
                             [else #f])) s)
    (let ([n (length (filter (cut = <> 0) (tree-map-values tm)))])
      (cond [(zero? n) (for-each print (tree-map-keys tm))]
            [(= 1 n) (tree-map-for-each tm (lambda (k v) (if (zero? v) (print k))))]
            [else (print "Impossible")])))
  0)
0