結果

問題 No.118 門松列(2)
ユーザー masamasa
提出日時 2019-02-01 11:58:15
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 759 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 123,648 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 13:27:48
合計ジャッジ時間 2,011 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <array>

using namespace std;
template<class T> bool maxPointer(T& a, T b) { if (a < b) {a = b;return true;}return false;}
template<class T> int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}}
template<class T> bool minPointer(T& a, T b) {if (a < b) {a = b;return true;}return false;}

const long mod = 1000000007;

int main(void){
    int N;
    cin >> N;
    int cnt[101] = {0};
    long long res = 0;
    
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        ++cnt[tmp];
    }

    for(int a = 0; a < 101; a++) for (int j = a+1; j < 101; j++) for (int s = j+1; s < 101; s++) res += (long long)(cnt[a] * cnt[j] * cnt[s]);

    cout << res % mod << endl;
}
0