結果

問題 No.826 連絡網
ユーザー letrangerjpletrangerjp
提出日時 2019-05-03 22:25:50
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 322 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 27,528 KB
最終ジャッジ日時 2023-08-30 06:12:34
合計ジャッジ時間 6,148 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
19,636 KB
testcase_01 AC 96 ms
15,368 KB
testcase_02 AC 95 ms
15,512 KB
testcase_03 WA -
testcase_04 AC 373 ms
15,392 KB
testcase_05 AC 142 ms
15,192 KB
testcase_06 AC 170 ms
15,424 KB
testcase_07 AC 238 ms
15,544 KB
testcase_08 AC 187 ms
15,456 KB
testcase_09 AC 185 ms
15,616 KB
testcase_10 AC 117 ms
15,108 KB
testcase_11 AC 224 ms
15,520 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!ruby -rprime

N, P = gets.split.map &:to_i
_primes = P.prime_division.to_h.keys
primes = Prime.each(N).select{|i|
  _primes.any?{|j|
    i == j || i * j <= N
  }
}
oks = [0] * (N+1)

(1..N).each{|i|
  primes.each{|pr|
    if i % pr == 0
      oks[i] = oks[i / pr] = 1
    end
  }
}

oks[1] = 0
oks[P] = 1
p oks.count(1)
0