結果

問題 No.118 門松列(2)
ユーザー ああいいああいい
提出日時 2022-03-24 23:45:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 266 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 81,660 KB
実行使用メモリ 77,952 KB
最終ジャッジ日時 2024-04-21 08:37:15
合計ジャッジ時間 2,672 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
60,032 KB
testcase_01 AC 58 ms
77,452 KB
testcase_02 AC 57 ms
77,440 KB
testcase_03 AC 58 ms
77,824 KB
testcase_04 AC 58 ms
77,568 KB
testcase_05 AC 57 ms
77,952 KB
testcase_06 AC 38 ms
52,352 KB
testcase_07 AC 36 ms
51,840 KB
testcase_08 AC 37 ms
51,968 KB
testcase_09 AC 56 ms
76,032 KB
testcase_10 AC 45 ms
62,208 KB
testcase_11 AC 45 ms
63,744 KB
testcase_12 AC 43 ms
60,928 KB
testcase_13 AC 42 ms
60,160 KB
testcase_14 AC 57 ms
75,776 KB
testcase_15 AC 41 ms
58,880 KB
testcase_16 AC 49 ms
68,068 KB
testcase_17 AC 42 ms
59,904 KB
testcase_18 AC 46 ms
63,744 KB
testcase_19 AC 48 ms
66,568 KB
testcase_20 AC 49 ms
68,096 KB
testcase_21 AC 54 ms
73,472 KB
testcase_22 AC 45 ms
62,592 KB
testcase_23 AC 53 ms
71,936 KB
testcase_24 AC 46 ms
64,384 KB
testcase_25 AC 48 ms
66,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
dat = [0] * 101
for a in A:
    dat[a] += 1
ans = 0
P = 10 ** 9 + 7
ans = N * (N - 1) * (N - 2) // 6 % P
for i in dat:
    ans -= i * (i-1) // 2 * (N - i)
    ans -= i * (i -1) * (i-2) // 6
    ans %= P
print(ans)
0