結果

問題 No.118 門松列(2)
ユーザー Mister
提出日時 2020-04-12 04:58:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 649 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 72,212 KB
最終ジャッジ日時 2025-01-09 17:37:28
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using lint = long long;

constexpr int X = 100;
constexpr lint MOD = 1000000007;

void solve() {
    std::vector<lint> cnt(X, 0);

    int n;
    std::cin >> n;

    while (n--) {
        int x;
        std::cin >> x;
        ++cnt[--x];
    }

    lint ans = 0;
    for (int k = 0; k < X; ++k) {
        for (int j = 0; j < k; ++j) {
            for (int i = 0; i < j; ++i) {
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }

    std::cout << ans % MOD << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0