結果

問題 No.719 Coprime
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-29 09:42:20
言語 Ruby
(3.2.2)
結果
AC  
実行時間 1,731 ms / 3,000 ms
コード長 209 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 11,464 KB
実行使用メモリ 25,496 KB
最終ジャッジ日時 2023-07-30 08:11:57
合計ジャッジ時間 21,718 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
15,352 KB
testcase_01 AC 101 ms
15,528 KB
testcase_02 AC 97 ms
15,416 KB
testcase_03 AC 101 ms
15,564 KB
testcase_04 AC 99 ms
15,388 KB
testcase_05 AC 102 ms
15,304 KB
testcase_06 AC 103 ms
15,412 KB
testcase_07 AC 104 ms
15,352 KB
testcase_08 AC 106 ms
15,488 KB
testcase_09 AC 107 ms
15,416 KB
testcase_10 AC 109 ms
15,408 KB
testcase_11 AC 110 ms
15,364 KB
testcase_12 AC 111 ms
15,412 KB
testcase_13 AC 113 ms
15,568 KB
testcase_14 AC 115 ms
15,720 KB
testcase_15 AC 115 ms
15,664 KB
testcase_16 AC 118 ms
15,752 KB
testcase_17 AC 118 ms
15,700 KB
testcase_18 AC 121 ms
15,652 KB
testcase_19 AC 122 ms
15,540 KB
testcase_20 AC 125 ms
15,648 KB
testcase_21 AC 126 ms
15,624 KB
testcase_22 AC 128 ms
15,700 KB
testcase_23 AC 130 ms
15,696 KB
testcase_24 AC 130 ms
15,712 KB
testcase_25 AC 131 ms
15,856 KB
testcase_26 AC 133 ms
15,920 KB
testcase_27 AC 132 ms
15,756 KB
testcase_28 AC 134 ms
15,768 KB
testcase_29 AC 135 ms
15,872 KB
testcase_30 AC 137 ms
15,916 KB
testcase_31 AC 136 ms
16,016 KB
testcase_32 AC 142 ms
16,068 KB
testcase_33 AC 142 ms
15,872 KB
testcase_34 AC 141 ms
16,084 KB
testcase_35 AC 142 ms
16,144 KB
testcase_36 AC 147 ms
16,048 KB
testcase_37 AC 144 ms
16,040 KB
testcase_38 AC 146 ms
16,144 KB
testcase_39 AC 147 ms
15,932 KB
testcase_40 AC 151 ms
15,884 KB
testcase_41 AC 172 ms
16,356 KB
testcase_42 AC 173 ms
16,136 KB
testcase_43 AC 218 ms
16,632 KB
testcase_44 AC 238 ms
16,404 KB
testcase_45 AC 245 ms
16,452 KB
testcase_46 AC 309 ms
17,200 KB
testcase_47 AC 308 ms
17,148 KB
testcase_48 AC 309 ms
16,948 KB
testcase_49 AC 338 ms
17,000 KB
testcase_50 AC 338 ms
17,200 KB
testcase_51 AC 342 ms
17,044 KB
testcase_52 AC 509 ms
18,012 KB
testcase_53 AC 746 ms
19,084 KB
testcase_54 AC 1,131 ms
21,544 KB
testcase_55 AC 1,162 ms
21,680 KB
testcase_56 AC 1,368 ms
22,980 KB
testcase_57 AC 1,377 ms
22,952 KB
testcase_58 AC 1,694 ms
24,900 KB
testcase_59 AC 1,724 ms
25,220 KB
testcase_60 AC 1,731 ms
25,496 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require'prime'
m=2048
l=(0..n=gets.to_i).map{{0=>0}}
(2..n).map{|i|r=s=0;t=1;Prime.each(i){|q|i%q<1&&(r=q;s|=t);t*=2};l[r][s%m]=i}
p l.inject([0]*m){|f,k|(0...m).map{|x|k.map{|s,i|s>(x&s)?0:f[x^s]+i}.max}}.max
0