結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー | ducktail |
提出日時 | 2019-08-01 16:23:08 |
言語 | Scheme (Gauche-0.9.14) |
結果 |
TLE
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 56 ms |
コンパイル使用メモリ | 5,216 KB |
実行使用メモリ | 90,620 KB |
最終ジャッジ日時 | 2023-09-18 17:25:20 |
合計ジャッジ時間 | 8,369 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 18 ms
11,872 KB |
testcase_01 | AC | 19 ms
11,760 KB |
testcase_02 | AC | 19 ms
11,924 KB |
testcase_03 | AC | 19 ms
11,708 KB |
testcase_04 | AC | 18 ms
11,780 KB |
testcase_05 | AC | 19 ms
11,928 KB |
testcase_06 | AC | 27 ms
12,108 KB |
testcase_07 | AC | 37 ms
12,780 KB |
testcase_08 | AC | 1,557 ms
90,360 KB |
testcase_09 | AC | 1,554 ms
90,620 KB |
testcase_10 | AC | 27 ms
13,208 KB |
testcase_11 | AC | 46 ms
15,552 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
ソースコード
(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)