結果
| 問題 | No.3156 Count That Day's N | 
| コンテスト | |
| ユーザー |  norioc | 
| 提出日時 | 2025-06-24 10:04:50 | 
| 言語 | Scheme (Gauche-0.9.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 2,107 bytes | 
| コンパイル時間 | 405 ms | 
| コンパイル使用メモリ | 8,100 KB | 
| 実行使用メモリ | 191,964 KB | 
| 最終ジャッジ日時 | 2025-06-24 10:04:57 | 
| 合計ジャッジ時間 | 6,649 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 TLE * 1 -- * 1 | 
| other | -- * 32 | 
ソースコード
(use scheme.list)
(use util.match)
(use srfi.13)  ; string
(use srfi.42)  ; list-ec
(use srfi.197) ; chain
(define input read-line)
(define (ii)
  (string->number (read-line)))
(define (li)
  (let ((s (read-line)))
    (map string->number (string-split s " "))))
(define (prn . args)
  (for-each (lambda (i x)
              (when (> i 0)
                (display " "))
              (display x))
            (iota (length args))
            args)
  (newline))
(define int string->number)
(define-method min ((xs <sequence>))
  (apply min xs))
(define (minmax . xs)
  (values->list (apply min&max xs)))
(define-method minmax ((xs <sequence>))
  (values->list (apply min&max xs)))
(define (sum xs) (apply + xs))
(define (divmod a b)
  (values->list (div-and-mod a b)))
(define (1+ n) (+ n 1))
(define pow
  (case-lambda
   ((a b) (expt a b))
   ((a b m) (expt-mod a b m))))
(define (yn b)
  (prn (if b "Yes" "No")))
(define-macro (input! bindings . body)
  (let loop ((bs (reverse bindings))
             (res '()))
    (if (null? bs)
        `(let*-values ,res
           ,@body)
        (cond
         ((symbol? (car bs))
          (loop (cdr bs)
                (cons `((,(car bs)) (values (ii)))
                      res)))
         ((list? (car bs))
          (loop (cdr bs)
                (cons `(,(car bs) (apply values (li)))
                      res)))
         (else
          'error)))))
#;
(define-macro (clet1 pat expr . body)
  `(receive ,pat (apply values ,expr)
     ,@body))
(define mlet1 match-let1)
(use scheme.set)
(input! ((K N))
  (let ((ns (list-ec (:while (: x 1 N) (< (pow x 6) N))
                     (:let x6 (pow x 6))
                     (:while (: y 1 N) (<= (+ x6 (pow y 4)) N))
                     (:let y4 (pow y 4))
                     (+ x6 y4))))
    (prn
     (set-count (^n
                 (cond
                  ((> (mod n K) 0) #f)
                  (else
                   (let* ((z2 (div n K))
                          (z (exact-integer-sqrt z2)))
                     (= (* z z) z2)))))
                (list->set eqv-comparator ns)))))
            
            
            
        