結果

問題 No.118 門松列(2)
ユーザー finefine
提出日時 2016-03-15 15:51:16
言語 Ruby
(3.3.0)
結果
AC  
実行時間 189 ms / 5,000 ms
コード長 301 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2024-04-17 14:09:27
合計ジャッジ時間 6,014 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
12,288 KB
testcase_01 AC 189 ms
19,840 KB
testcase_02 AC 188 ms
19,584 KB
testcase_03 AC 186 ms
19,712 KB
testcase_04 AC 168 ms
19,968 KB
testcase_05 AC 164 ms
19,968 KB
testcase_06 AC 79 ms
12,288 KB
testcase_07 AC 81 ms
12,160 KB
testcase_08 AC 82 ms
12,160 KB
testcase_09 AC 153 ms
19,456 KB
testcase_10 AC 113 ms
13,312 KB
testcase_11 AC 116 ms
13,696 KB
testcase_12 AC 114 ms
12,928 KB
testcase_13 AC 110 ms
12,288 KB
testcase_14 AC 156 ms
19,456 KB
testcase_15 AC 102 ms
12,288 KB
testcase_16 AC 132 ms
15,872 KB
testcase_17 AC 110 ms
12,160 KB
testcase_18 AC 120 ms
13,696 KB
testcase_19 AC 130 ms
15,360 KB
testcase_20 AC 130 ms
15,744 KB
testcase_21 AC 153 ms
18,432 KB
testcase_22 AC 119 ms
13,440 KB
testcase_23 AC 145 ms
17,792 KB
testcase_24 AC 117 ms
13,824 KB
testcase_25 AC 128 ms
15,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map(&:to_i).sort
h = Hash.new(0)
MOD = 1000000007
a.each{|x|
    h[x] += 1
    }
h = h.values
n = h.size
ans = 0
n.times{|i|
    (i + 1).upto(n - 1){|j|
        (j + 1).upto(n - 1){|k|
            ans += (h[i] * h[j] * h[k]) % MOD
            }
        }
    }
p ans % MOD
0