結果

問題 No.368 LCM of K-products
ユーザー cielciel
提出日時 2016-11-10 17:39:20
言語 Ruby
(3.3.0)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,936 KB
実行使用メモリ 23,624 KB
最終ジャッジ日時 2023-10-23 21:20:31
合計ジャッジ時間 6,314 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
外部呼び出し有り
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
23,480 KB
testcase_01 AC 146 ms
23,624 KB
testcase_02 AC 133 ms
23,224 KB
testcase_03 AC 130 ms
23,356 KB
testcase_04 AC 134 ms
23,560 KB
testcase_05 AC 132 ms
23,264 KB
testcase_06 AC 120 ms
22,660 KB
testcase_07 AC 118 ms
22,660 KB
testcase_08 AC 119 ms
22,660 KB
testcase_09 AC 119 ms
22,660 KB
testcase_10 AC 118 ms
22,660 KB
testcase_11 AC 119 ms
22,660 KB
testcase_12 AC 119 ms
22,660 KB
testcase_13 AC 129 ms
23,160 KB
testcase_14 AC 132 ms
23,564 KB
testcase_15 AC 134 ms
23,584 KB
testcase_16 AC 132 ms
23,580 KB
testcase_17 AC 129 ms
23,248 KB
testcase_18 AC 134 ms
23,588 KB
testcase_19 AC 123 ms
22,868 KB
testcase_20 AC 130 ms
23,248 KB
testcase_21 AC 122 ms
22,852 KB
testcase_22 AC 135 ms
23,592 KB
testcase_23 AC 118 ms
22,660 KB
testcase_24 AC 117 ms
22,660 KB
testcase_25 AC 118 ms
22,660 KB
testcase_26 AC 117 ms
22,660 KB
testcase_27 AC 117 ms
22,660 KB
testcase_28 AC 118 ms
22,660 KB
testcase_29 AC 119 ms
22,660 KB
testcase_30 AC 118 ms
22,664 KB
testcase_31 AC 122 ms
22,660 KB
testcase_32 AC 117 ms
22,660 KB
testcase_33 AC 126 ms
23,060 KB
testcase_34 AC 127 ms
22,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require'openssl'
M=10**9+7
E=Hash.new{|h,k|h[k]=[]}
N,K=gets.split.map &:to_i
IO.popen('factor '+gets){|_|_.map{|l|l.split[1..-1].map(&:to_i).group_by(&:+@).map{|k,v|E[k]<<v.size}}}
r=1
E.each{|k,v|r=r*k.to_bn.mod_exp(v.sort_by(&:-@).take(K).reduce(:+),M)%M}
p r
0