結果

問題 No.118 門松列(2)
ユーザー はむ吉🐹
提出日時 2016-03-01 18:36:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 499 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,300 KB
最終ジャッジ日時 2024-10-09 08:02:29
合計ジャッジ時間 3,478 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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