結果

問題 No.118 門松列(2)
ユーザー lloyzlloyz
提出日時 2023-07-01 01:57:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 91,680 KB
最終ジャッジ日時 2023-09-21 19:39:18
合計ジャッジ時間 4,681 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
76,424 KB
testcase_01 AC 110 ms
91,680 KB
testcase_02 AC 107 ms
91,500 KB
testcase_03 AC 108 ms
91,616 KB
testcase_04 AC 109 ms
91,628 KB
testcase_05 AC 114 ms
91,676 KB
testcase_06 AC 90 ms
76,308 KB
testcase_07 AC 83 ms
76,296 KB
testcase_08 AC 84 ms
76,312 KB
testcase_09 AC 106 ms
89,728 KB
testcase_10 AC 92 ms
77,596 KB
testcase_11 AC 94 ms
78,688 KB
testcase_12 AC 88 ms
76,576 KB
testcase_13 AC 91 ms
76,652 KB
testcase_14 AC 109 ms
89,872 KB
testcase_15 AC 90 ms
76,496 KB
testcase_16 AC 99 ms
82,980 KB
testcase_17 AC 90 ms
76,580 KB
testcase_18 AC 92 ms
78,896 KB
testcase_19 AC 97 ms
81,544 KB
testcase_20 AC 97 ms
82,552 KB
testcase_21 AC 103 ms
87,924 KB
testcase_22 AC 92 ms
77,928 KB
testcase_23 AC 102 ms
86,220 KB
testcase_24 AC 91 ms
79,532 KB
testcase_25 AC 96 ms
81,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

fact = [1] * (n + 1)
inv = [1] * (n + 1)
finv = [1] * (n + 1)
for i in range(2, n + 1):
    fact[i] = fact[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod

C = [0 for _ in range(101)]
for i in range(n):
    C[A[i]] += 1
ans = 0
for x in range(1, 101):
    xx = C[x]
    for y in range(x + 1, 101):
        yy = C[y]
        for z in range(y + 1, 101):
            zz = C[z]
            ans += xx * yy % mod * zz % mod
            ans %= mod
print(ans)
0