結果

問題 No.118 門松列(2)
ユーザー Hydrogen332
提出日時 2025-05-20 23:11:22
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 4,649 ms
コンパイル使用メモリ 276,640 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-20 23:11:28
合計ジャッジ時間 5,029 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()

#include <atcoder/modint>
using namespace atcoder;
using mint = modint1000000007;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int maxi = 100;
    
    int N;
    cin >> N;
    vector<ll> cnt(maxi, 0);
    rep(i, 0, N) {
        int A;
        cin >> A;
        ++cnt[A - 1];
    }
    
    mint ans = 0;
    rep(i, 0, maxi - 2) rep(j, i + 1, maxi - 1) rep(k, j + 1, maxi) {
        ans += cnt[i]*cnt[j]*cnt[k];
    }
    
    cout << ans.val() << '\n';
}
0