結果

問題 No.24 数当てゲーム
ユーザー MiyamonYMiyamonY
提出日時 2019-09-03 02:44:07
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 5,380 KB
実行使用メモリ 20,200 KB
最終ジャッジ日時 2023-08-23 09:20:53
合計ジャッジ時間 1,837 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
18,352 KB
testcase_01 AC 64 ms
18,156 KB
testcase_02 AC 64 ms
18,348 KB
testcase_03 AC 65 ms
18,168 KB
testcase_04 AC 63 ms
18,164 KB
testcase_05 AC 64 ms
18,320 KB
testcase_06 AC 65 ms
20,200 KB
testcase_07 AC 64 ms
18,372 KB
testcase_08 AC 64 ms
18,272 KB
testcase_09 AC 64 ms
18,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(use scheme.set)

(define (read-number)
  (string->number (read-line)))

(define (solve matrix)
  (define neg-set (set eq-comparator))
  (define pos-set (apply set eq-comparator (iota 10)))

  (dolist (l (filter (lambda (line)
		       (eqv? (last line) 'NO)) matrix))
	  (list->set! neg-set (take l 4)))

  (dolist (l (filter (lambda (line)
		       (eqv? (last line) 'YES)) matrix))
	  (set-intersection! pos-set (list->set eq-comparator (take l 4))))
  (car (filter (lambda (n) (and (set-contains? pos-set n)
			   (not (set-contains? neg-set n)))) (iota 10))))

(let* ((n (read-number))
       (matrix
	(map (lambda (_) (map (lambda (_) (read)) (iota 5))) (iota n))))

  (print (solve matrix)))
0