結果

問題 No.118 門松列(2)
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2015-01-06 23:31:03
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,003 bytes
コンパイル時間 1,048 ms
コンパイル使用メモリ 91,848 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-30 11:29:14
合計ジャッジ時間 2,519 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,384 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 21 ms
4,380 KB
testcase_10 AC 5 ms
4,384 KB
testcase_11 AC 7 ms
4,384 KB
testcase_12 AC 5 ms
4,384 KB
testcase_13 AC 3 ms
4,384 KB
testcase_14 AC 20 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 12 ms
4,380 KB
testcase_17 AC 3 ms
4,384 KB
testcase_18 AC 7 ms
4,380 KB
testcase_19 AC 11 ms
4,380 KB
testcase_20 AC 11 ms
4,380 KB
testcase_21 AC 17 ms
4,380 KB
testcase_22 AC 6 ms
4,380 KB
testcase_23 AC 16 ms
4,380 KB
testcase_24 AC 7 ms
4,380 KB
testcase_25 AC 11 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))

#define MOD 1000000007

int main(){
  int n;
  cin>>n;
  vector<int> v;
  rep(i,0,n){
    int a;
    cin>>a;
    v.pb(a);
  }
  int d[101];
  clr(d,0);
  rep(i,0,v.sz){
    d[v[i]]++;
  }
  rep(i,1,101){
    d[i]+=d[i-1];
  }
  sort(all(v));
  long long ans = 0LL;
  rep(i,0,v.sz){
    int a = d[v[i]-1];
    int b = d[100]-d[v[i]];
    ans += a*b;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

0