結果

問題 No.118 門松列(2)
ユーザー なお
提出日時 2015-01-06 23:33:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 1,667 ms
コンパイル使用メモリ 158,560 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-13 02:47:33
合計ジャッジ時間 4,814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 3 RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
const int MOD = 1e9+7;
ll A[11111],B[111];
int main(){
    int N; cin>>N;
    REP(i,N){cin >> A[i]; B[A[i]]++;}
    for(int i = 1; i <= 100; i++) B[i] = B[i] + B[i-1];
    ll res = 0;
    REP(i,N){int v = A[i]; res += (B[v-1]*(B[100]-B[v])) % MOD;}
    cout << res << endl;
}
0