結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー | siman |
提出日時 | 2021-07-01 20:06:01 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 436 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 11,224 KB |
実行使用メモリ | 89,076 KB |
最終ジャッジ日時 | 2023-09-10 18:16:39 |
合計ジャッジ時間 | 9,171 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 77 ms
19,696 KB |
testcase_01 | AC | 77 ms
15,144 KB |
testcase_02 | AC | 78 ms
15,044 KB |
testcase_03 | AC | 76 ms
15,140 KB |
testcase_04 | AC | 77 ms
15,160 KB |
testcase_05 | AC | 78 ms
15,112 KB |
testcase_06 | AC | 81 ms
15,080 KB |
testcase_07 | AC | 88 ms
15,044 KB |
testcase_08 | AC | 881 ms
15,216 KB |
testcase_09 | AC | 891 ms
15,184 KB |
testcase_10 | AC | 81 ms
15,416 KB |
testcase_11 | AC | 87 ms
15,636 KB |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
X, Y = gets.split.map(&:to_i) S = Math.sqrt(X).ceil if X == Y L = S else L = Math.sqrt(Y).ceil end counter = Hash.new(0) S.upto(L) do |x| v = x ** 2 next if v < X next if Y < v counter[v] += 1 end L.times do |y| dy = y ** 2 L.times do |x| dx = x ** 2 v = dy + dx next if v < X break if Y < v counter[v] += 1 end end if counter.values.empty? puts 0 else puts counter.values.max * 4 end