結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
|
提出日時 | 2019-08-01 16:23:08 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 66 ms |
コンパイル使用メモリ | 5,248 KB |
実行使用メモリ | 174,592 KB |
最終ジャッジ日時 | 2024-07-05 07:32:15 |
合計ジャッジ時間 | 8,274 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 TLE * 1 -- * 8 |
ソースコード
(define (vector-update v x y i j) (let1 ix (+ (* i i) (* j j)) (cond [(<= x ix y) (let1 vl (vector-ref v ix) (cond [(or (zero? i) (zero? j)) (vector-set! v ix (+ 2 vl))] [else (vector-set! v ix (+ 4 vl))]))]))) (define (solve x y) (let ([v (make-vector (+ y 1) 0)]) (let loop ([i 0] [j 0]) (cond [(> (* i i) y) #t] [(> (* j j) y) (loop (+ i 1) 0)] [else (vector-update v x y i j) (loop i (+ j 1))])) (apply max (map (^i (vector-ref v i)) (iota (- y x -1) x))))) (define (main args) (let* ([x (read)] [y (read)]) (print (solve x y))) 0)