結果

問題 No.774 tatyamと素数大富豪
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-02-21 12:41:27
言語 Ruby
(3.2.2)
結果
AC  
実行時間 711 ms / 2,000 ms
コード長 184 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 59,716 KB
最終ジャッジ日時 2023-08-11 00:59:15
合計ジャッジ時間 9,600 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 711 ms
54,784 KB
testcase_01 AC 110 ms
20,152 KB
testcase_02 AC 604 ms
59,300 KB
testcase_03 AC 118 ms
20,388 KB
testcase_04 AC 110 ms
20,060 KB
testcase_05 AC 110 ms
20,412 KB
testcase_06 AC 108 ms
20,112 KB
testcase_07 AC 109 ms
20,068 KB
testcase_08 AC 109 ms
20,024 KB
testcase_09 AC 616 ms
59,664 KB
testcase_10 AC 605 ms
59,400 KB
testcase_11 AC 601 ms
59,448 KB
testcase_12 AC 633 ms
50,216 KB
testcase_13 AC 640 ms
50,324 KB
testcase_14 AC 154 ms
23,444 KB
testcase_15 AC 597 ms
59,716 KB
testcase_16 AC 606 ms
59,560 KB
testcase_17 AC 543 ms
45,184 KB
testcase_18 AC 598 ms
59,388 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

require 'openssl'

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

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

puts ans || -1
0