結果

問題 No.118 門松列(2)
ユーザー lllllll88938494lllllll88938494
提出日時 2022-03-16 00:27:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 169 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 17,508 KB
最終ジャッジ日時 2023-10-23 23:55:01
合計ジャッジ時間 4,238 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,240 KB
testcase_01 AC 169 ms
17,508 KB
testcase_02 AC 162 ms
17,060 KB
testcase_03 AC 157 ms
17,176 KB
testcase_04 AC 162 ms
17,480 KB
testcase_05 AC 159 ms
17,252 KB
testcase_06 AC 27 ms
10,096 KB
testcase_07 AC 27 ms
10,096 KB
testcase_08 AC 27 ms
10,096 KB
testcase_09 AC 154 ms
16,844 KB
testcase_10 AC 120 ms
11,624 KB
testcase_11 AC 124 ms
11,988 KB
testcase_12 AC 117 ms
11,024 KB
testcase_13 AC 121 ms
10,680 KB
testcase_14 AC 153 ms
16,720 KB
testcase_15 AC 114 ms
10,240 KB
testcase_16 AC 135 ms
13,880 KB
testcase_17 AC 118 ms
10,608 KB
testcase_18 AC 127 ms
12,008 KB
testcase_19 AC 132 ms
13,252 KB
testcase_20 AC 132 ms
13,440 KB
testcase_21 AC 146 ms
15,632 KB
testcase_22 AC 121 ms
11,636 KB
testcase_23 AC 143 ms
15,276 KB
testcase_24 AC 127 ms
12,196 KB
testcase_25 AC 129 ms
13,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict as df
n=int(input())
ns=list(map(int,input().split()))
dic=df(int)
sns=list(set(ns))
mod=10**9+7
for i in ns:
    dic[i] += 1
ans=0

for i in range(len(sns)-2):
    for j in range(i+1,len(sns)-1):
        for k in range(j+1,len(sns)):
            ans+=dic[sns[i]]*dic[sns[j]]*dic[sns[k]]
            ans%=mod
    
print(ans)

0