結果

問題 No.182 新規性の虜
ユーザー pekempeypekempey
提出日時 2016-06-23 12:18:56
言語 Scheme
(Gauche-0.9.13)
結果
AC  
実行時間 362 ms / 5,000 ms
コード長 720 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 5,372 KB
実行使用メモリ 24,208 KB
最終ジャッジ日時 2023-08-27 11:37:42
合計ジャッジ時間 5,972 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,728 KB
testcase_01 AC 18 ms
11,900 KB
testcase_02 AC 21 ms
13,824 KB
testcase_03 AC 18 ms
11,872 KB
testcase_04 AC 18 ms
11,812 KB
testcase_05 AC 18 ms
11,708 KB
testcase_06 AC 20 ms
11,912 KB
testcase_07 AC 19 ms
11,772 KB
testcase_08 AC 231 ms
17,644 KB
testcase_09 AC 356 ms
24,208 KB
testcase_10 AC 304 ms
20,408 KB
testcase_11 AC 260 ms
20,296 KB
testcase_12 AC 115 ms
17,524 KB
testcase_13 AC 18 ms
11,724 KB
testcase_14 AC 19 ms
11,824 KB
testcase_15 AC 19 ms
11,760 KB
testcase_16 AC 18 ms
11,772 KB
testcase_17 AC 19 ms
11,728 KB
testcase_18 AC 291 ms
20,220 KB
testcase_19 AC 215 ms
20,296 KB
testcase_20 AC 135 ms
17,636 KB
testcase_21 AC 362 ms
20,240 KB
testcase_22 AC 176 ms
17,716 KB
testcase_23 AC 20 ms
11,812 KB
testcase_24 AC 330 ms
20,328 KB
testcase_25 AC 311 ms
20,244 KB
testcase_26 AC 59 ms
16,752 KB
testcase_27 AC 19 ms
11,940 KB
evil01.txt AC 338 ms
20,440 KB
evil02.txt AC 341 ms
20,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(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 (count-same a)
  (let ((head (car a)))
    (let loop((b a) (res 0))
      (if (null? b)
	  res
	  (if (= head (car b))
	      (loop (cdr b) (+ res 1))
	      res)))))

(define (solve a)
  (let loop((b (sort a <)) (res 0))
    (if (null? b)
	res
	(let ((cnt (count-same b)))
      	  (loop (drop b cnt) (if (= cnt 1) (+ res 1) res))))))
	
(display (solve (let ((N (read))) (map (lambda (x) (read)) (iota N)))))
(newline)
0