結果
| 問題 |
No.118 門松列(2)
|
| ユーザー |
|
| 提出日時 | 2018-08-14 17:34:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 673 bytes |
| コンパイル時間 | 1,734 ms |
| コンパイル使用メモリ | 174,308 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 08:51:00 |
| 合計ジャッジ時間 | 2,881 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
#ifdef DEBUG
freopen("input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
int A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
map <int, int> mp;
for (int i = 0; i < N; i++) {
mp[A[i]]++;
}
long cnt, mod;
mod = 100000007;
cnt = (N * (N - 1) * (N - 2)) / 6;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
int n = itr->second;
if (n > 2)
cnt -= (n * (n - 1) * (n - 2)) / 6;
if (n > 1)
cnt -= (n * (n - 1)) / 2 * (N - n);
}
cout << cnt % mod << endl;
return 0;
}