結果

問題 No.774 tatyamと素数大富豪
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-02-21 12:43:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 742 ms / 2,000 ms
コード長 211 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 59,264 KB
最終ジャッジ日時 2024-04-28 18:13:25
合計ジャッジ時間 10,739 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 742 ms
59,136 KB
testcase_01 AC 128 ms
18,688 KB
testcase_02 AC 668 ms
58,240 KB
testcase_03 AC 139 ms
19,584 KB
testcase_04 AC 127 ms
18,816 KB
testcase_05 AC 130 ms
18,944 KB
testcase_06 AC 128 ms
18,816 KB
testcase_07 AC 127 ms
18,816 KB
testcase_08 AC 128 ms
18,816 KB
testcase_09 AC 714 ms
59,264 KB
testcase_10 AC 677 ms
58,112 KB
testcase_11 AC 675 ms
58,240 KB
testcase_12 AC 683 ms
52,480 KB
testcase_13 AC 698 ms
52,992 KB
testcase_14 AC 183 ms
22,016 KB
testcase_15 AC 677 ms
58,240 KB
testcase_16 AC 681 ms
58,112 KB
testcase_17 AC 624 ms
45,056 KB
testcase_18 AC 672 ms
58,368 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'openssl'

n = gets.to_i
a = gets.chomp.split

ans = a.permutation(n)
       .map(&:join)
       .uniq
       .sort_by{|str| str.to_i * -1}
       .find{|str| OpenSSL::BN.new(str).prime?}

puts ans || -1
0