結果

問題 No.118 門松列(2)
ユーザー itezpace
提出日時 2016-09-21 08:07:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 70,344 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-17 10:18:38
合計ジャッジ時間 2,418 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
  ll N,A;
  cin>>N;
  map<ll,ll> m;
  for(ll i=0; i<N; ++i){
    cin>>A;
    if(m.count(A)>0){
      m[A]+=1;
    } else {
      m.insert(make_pair(A,1));
    }
  }
  ll a=m.size();
  ll b=1;
  for(ll i=a; i>a-3; --i){
    b%=mod;
    ll i2=i;
    i2%=mod;
    b*=i;
  }
  b%=mod;
  ll c=6;
  ll d=b/c;
  for(auto i=m.begin(); i!=m.end(); ++i){
    d%=mod;
    ll e=i->second;
    d*=e;
  }
  d%=mod;
  cout<<d<<endl;
  return 0;
}
0