結果

問題 No.118 門松列(2)
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-03-01 18:36:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 499 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,476 KB
最終ジャッジ日時 2024-04-17 14:01:38
合計ジャッジ時間 3,423 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 108 ms
16,476 KB
testcase_02 AC 112 ms
15,760 KB
testcase_03 AC 116 ms
15,896 KB
testcase_04 AC 109 ms
16,156 KB
testcase_05 AC 107 ms
16,280 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 106 ms
15,620 KB
testcase_10 AC 81 ms
11,776 KB
testcase_11 AC 89 ms
12,160 KB
testcase_12 AC 85 ms
11,520 KB
testcase_13 AC 83 ms
11,008 KB
testcase_14 AC 109 ms
15,476 KB
testcase_15 AC 75 ms
10,752 KB
testcase_16 AC 92 ms
13,696 KB
testcase_17 AC 81 ms
10,880 KB
testcase_18 AC 84 ms
12,160 KB
testcase_19 AC 94 ms
13,184 KB
testcase_20 AC 90 ms
13,184 KB
testcase_21 AC 98 ms
14,800 KB
testcase_22 AC 85 ms
11,776 KB
testcase_23 AC 101 ms
14,708 KB
testcase_24 AC 83 ms
12,416 KB
testcase_25 AC 87 ms
13,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import collections
import itertools


MODULUS = 10 ** 9 + 7


def main():
    _ = input()
    counter = collections.Counter(map(int, input().split()))
    num_distinct_heights = len(counter)
    answer = 0
    if num_distinct_heights >= 3:
        for key1, key2, key3 in itertools.combinations(counter.keys(), 3):
            answer += counter[key1] * counter[key2] * counter[key3]
    print(answer % MODULUS)


if __name__ == '__main__':
    main()
0