結果

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
#include <climits>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#define INF INT_MAX / 2
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef long long ll;

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	map<int,int>counter;
	for(int i=0;i<n;i++){
		counter[a[i]]++;
	}

	int cnt = 0;
	long long tmp = 1;
	auto it = counter.begin();
	for(;it!=counter.end();it++){
		tmp *= it->second;
		cnt++;
	}

	long long ans = cnt * (cnt-1) %MOD * (cnt-2) %MOD / 6;
	ans *= tmp;
	cout << ans%MOD << endl;
}
0