結果
問題 | No.371 ぼく悪いプライムじゃないよ |
ユーザー | mai |
提出日時 | 2018-05-20 11:26:02 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 808 bytes |
コンパイル時間 | 56 ms |
コンパイル使用メモリ | 11,276 KB |
実行使用メモリ | 19,740 KB |
最終ジャッジ日時 | 2023-09-10 23:56:35 |
合計ジャッジ時間 | 5,721 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 89 ms
15,220 KB |
testcase_01 | AC | 89 ms
15,352 KB |
testcase_02 | AC | 88 ms
15,324 KB |
testcase_03 | AC | 88 ms
15,360 KB |
testcase_04 | AC | 88 ms
15,276 KB |
testcase_05 | AC | 91 ms
15,376 KB |
testcase_06 | AC | 91 ms
15,312 KB |
testcase_07 | AC | 93 ms
15,224 KB |
testcase_08 | AC | 93 ms
15,348 KB |
testcase_09 | AC | 92 ms
15,168 KB |
testcase_10 | AC | 92 ms
15,248 KB |
testcase_11 | AC | 89 ms
15,248 KB |
testcase_12 | AC | 89 ms
15,444 KB |
testcase_13 | AC | 88 ms
15,144 KB |
testcase_14 | AC | 90 ms
15,112 KB |
testcase_15 | AC | 88 ms
15,200 KB |
testcase_16 | AC | 88 ms
15,260 KB |
testcase_17 | AC | 88 ms
15,212 KB |
testcase_18 | AC | 87 ms
15,228 KB |
testcase_19 | AC | 89 ms
15,376 KB |
testcase_20 | AC | 93 ms
15,260 KB |
testcase_21 | AC | 88 ms
15,384 KB |
testcase_22 | AC | 352 ms
15,404 KB |
testcase_23 | AC | 92 ms
15,364 KB |
testcase_24 | AC | 94 ms
15,240 KB |
testcase_25 | TLE | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i);end require 'prime' def my_unko_algorithm(n) return 2 if n.even? 1.upto(n) do |i| f = i*2+1 return f if n%f == 0 end throw "hoge" end L, H = ascan sqrtH = Math.sqrt(H).to_i ans = [0,0] sqrtH.downto(2) do |x| # この枝刈りの計算量が分からん break if ans[0] > x next unless x.prime? ## 篩を使えばこの計算量をループの外に出せる y = H / x ## niceな実装なら計算量O(素数の個数(sqrt(N))) #yfact = y.prime_division.map(&:shift).min #yfact = my_unko_algorithm(y) y.downto(2) do |y2| break if x*y2 < L y2fact = my_unko_algorithm(y2) curr = [ [x,y2fact].min, x*y2 ] ans = [curr, ans].max end end p ans[1]