結果

問題 No.758 VVVVV
ユーザー cielciel
提出日時 2020-03-17 09:39:54
言語 Ruby
(3.2.2)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 11,556 KB
実行使用メモリ 21,108 KB
最終ジャッジ日時 2023-08-20 03:15:45
合計ジャッジ時間 5,273 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,224 KB
testcase_01 AC 81 ms
15,172 KB
testcase_02 AC 81 ms
15,216 KB
testcase_03 AC 227 ms
20,976 KB
testcase_04 AC 149 ms
18,140 KB
testcase_05 AC 130 ms
17,124 KB
testcase_06 AC 125 ms
16,848 KB
testcase_07 AC 227 ms
20,880 KB
testcase_08 AC 155 ms
18,236 KB
testcase_09 AC 109 ms
16,112 KB
testcase_10 AC 135 ms
17,452 KB
testcase_11 AC 234 ms
21,048 KB
testcase_12 AC 118 ms
16,520 KB
testcase_13 AC 130 ms
17,060 KB
testcase_14 AC 108 ms
16,184 KB
testcase_15 AC 97 ms
15,956 KB
testcase_16 AC 102 ms
16,056 KB
testcase_17 AC 210 ms
20,368 KB
testcase_18 AC 150 ms
18,156 KB
testcase_19 AC 234 ms
21,108 KB
testcase_20 AC 123 ms
16,788 KB
testcase_21 AC 127 ms
16,756 KB
testcase_22 AC 235 ms
20,864 KB
testcase_23 AC 79 ms
15,136 KB
testcase_24 AC 80 ms
15,296 KB
testcase_25 AC 80 ms
15,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
M=10**9+7;I=[1,1];*F=I;*R=I;n=gets.to_i-1
2.upto(n){|i|I<<z=(M-M/i)*I[M%i]%M;F<<i*F[-1]%M;R<<z*R[-1]%M}
r=$<.map{|e|e.split.map(&:to_i).min}.uniq.size
p r<1?1:F[n]**2*R[r]*R[n-r]*R[r-1]*R[n-r+1]*I[n]%M
0