結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2016-11-28 00:40:50 |
| 言語 | Scheme (Gauche-0.9.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 664 bytes |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 5,504 KB |
| 実行使用メモリ | 20,992 KB |
| 最終ジャッジ日時 | 2024-12-24 04:36:19 |
| 合計ジャッジ時間 | 2,915 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
(use util.combinations)
(define (kadomatsu? x y z)
(and (not (= x y))
(not (= y z))
(not (= z x))
(< x z)
(or (= y (min x y z))
(= y (max x y z)))))
(define (increasing-kadomatsu? numbers)
(let loop ((ls numbers))
(if (< (length ls) 3)
#t
(if (apply kadomatsu? (take ls 3))
(loop (cdr ls))
#f))))
(define (MAIN)
(let loop ((numbers-list (permutations (map string->number (string-split (read-line) #\space)))))
(if (null? numbers-list)
"NO"
(if (increasing-kadomatsu? (car numbers-list))
"YES"
(loop (cdr numbers-list))))))
(print (MAIN))
neko_the_shadow