結果

問題 No.118 門松列(2)
ユーザー pekempeypekempey
提出日時 2015-12-20 23:48:01
言語 Python2
(2.7.18)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 266 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 12,168 KB
最終ジャッジ日時 2024-04-17 13:18:10
合計ジャッジ時間 2,072 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
6,400 KB
testcase_01 AC 84 ms
11,936 KB
testcase_02 AC 80 ms
12,004 KB
testcase_03 AC 82 ms
11,972 KB
testcase_04 AC 79 ms
12,168 KB
testcase_05 AC 77 ms
12,032 KB
testcase_06 AC 11 ms
6,400 KB
testcase_07 AC 11 ms
6,400 KB
testcase_08 AC 11 ms
6,272 KB
testcase_09 AC 76 ms
11,844 KB
testcase_10 AC 24 ms
7,424 KB
testcase_11 AC 29 ms
7,936 KB
testcase_12 AC 20 ms
7,040 KB
testcase_13 AC 16 ms
6,912 KB
testcase_14 AC 71 ms
11,620 KB
testcase_15 AC 12 ms
6,400 KB
testcase_16 AC 45 ms
9,344 KB
testcase_17 AC 16 ms
6,784 KB
testcase_18 AC 29 ms
7,808 KB
testcase_19 AC 41 ms
9,088 KB
testcase_20 AC 45 ms
9,088 KB
testcase_21 AC 66 ms
10,848 KB
testcase_22 AC 26 ms
7,552 KB
testcase_23 AC 58 ms
10,224 KB
testcase_24 AC 31 ms
8,064 KB
testcase_25 AC 40 ms
8,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
a = map(int, raw_input().split())
a.sort()

num = [0] * 101
for x in a:
	num[x] += 1

s1, s2, s3 = 0, 0, 0
for x in num:
	s1 += x
	s2 += x * x
	s3 += x * x * x

ans = (s1 ** 3 - s1 * s2 - 2 * s1 * s2 + 2 * s3) / 6
mod = 10 ** 9 + 7
ans %= mod

print ans
0