結果
| 問題 |
No.118 門松列(2)
|
| ユーザー |
古寺いろは
|
| 提出日時 | 2015-04-08 00:35:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 979 bytes |
| コンパイル時間 | 1,342 ms |
| コンパイル使用メモリ | 167,248 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 10:58:14 |
| 合計ジャッジ時間 | 2,479 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 22 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
map<int, int> m1;
for (int i = 0; i < N; i++)
{
cin >> A[i];
m1[A[i]]++;
}
map<int, int> m2;
for (auto i : m1){
m2[i.second]++;
}
long long mod = (long long)1e9 + 7;
long long ans = 0;
for (auto i: m2)
{
for (auto j : m2)
{
if (i.first <= j.first) continue;
for (auto k : m2)
{
if (i.first <= k.first) continue;
if (j.first <= k.first) continue;
ans += (long long)i.first * j.first % mod * k.first;
ans %= mod;
}
}
}
for (auto i : m2)
{
for (auto j : m2)
{
if (i == j) continue;
ans += (long long)i.first * i.first % mod * ((long long)i.second * (i.second - 1) / 2) % mod * j.second % mod;
ans %= mod;
}
}
for (auto i : m2)
{
ans += (long long)i.first * i.first % mod * i.first % mod * (((long long)(i.second) * (i.second - 1) * (i.second - 2) / 6) % mod) % mod;
ans %= mod;
}
cout << ans << endl;
}
古寺いろは